The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

Filter by custom fields

Topic prefix

AI Assistant
Change Frontend App...
 
Notifications
Clear all

[Solved] Change Frontend Appearance

12 Posts
2 Users
4 Reactions
2,433 Views
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 
[#1663]

Hi,

I managed to add an additional field to the comment box - name: 'city'.

Now I want to display this like:

Tim from LondonΒ  - 3 days ago
...

but I only managed to show this in the backend were you manage the comments in wp:

image

Can you point me towards the direction where to change what to archive what I'm looking for?
Is there anything you also need to know to be able to help me?

Thanks in advance!


 
Posted : 12/02/2021 4:32 am
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

to be more precise I want it to look like this:

image

Β 

and if the field has no value it should look like this

image

Β 

but of course this is a matter of logic in the code (change) itself.

Β 

...again thanks a lot for any help!

Β 


 
Posted : 12/02/2021 4:35 am
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Any Idea from the wpdiscuz-Team itself?

Mayby you, @asti, might help me with this?


 
Posted : 10/03/2021 4:41 pm
Asti
 Asti
(@asti)
Posts: 8257
Illustrious Member Support
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@nstoeckigt,

Sorry for the late response.Β 

We're really sorry, but there is not any simple solution we can post here. We may suggest you use the wpdiscuz_comment_authorΒ hook for this customization.


In case you want to say thank you! πŸ™‚
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 10/03/2021 5:08 pm
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@asti Thank you, at least this is a "point towards the direction where to change what to archive what I'm looking for"!

I update this Post when I find a solution to let you all know what to do in similar cases.

Β 


 
Posted : 15/03/2021 11:51 pm
Asti reacted
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

I managed to insert the desired field into the code:

-            $headerComponent = str_replace(["{AUTHOR}", "{DATE}", "{STATUS}", "{SHARE}", "{LINK}"], [$args["components"]["author.html"], $showDate ? $args["components"]["date.html"] : "", $showStatus ? $args["components"]["status.html"] : "", $showShare ? $args["components"]["share.html"] : "", $showLink ? $args["components"]["link.html"] : ""], $args["components"]["header.html"]);
+            $headerComponent = str_replace(["{AUTHOR}", "{CITY}", "{DATE}", "{STATUS}", "{SHARE}", "{LINK}"], [$args["components"]["author.html"], $showCity ? $args["components"]["city.html"] : "", $showDate ? $args["components"]["date.html"] : "", $showStatus ? $args["components"]["status.html"] : "", $showShare ? $args["components"]["share.html"] : "", $showLink ? $args["components"]["link.html"] : ""], $args["components"]["header.html"]);

the related variable (is) should be evaluated like

Spoiler
$showCity
+
+        $showCity = false;
+        //$city .= apply_filters("wpdiscuz_comment_city", "", $comment, $user["user"], $args["city"]);
+        //$city = isset($commentMetas[self::META_KEY_CITY]) ? strval($commentMetas[self::META_KEY_CITY]);
+        $city .= 'London';
+        if ($city) {
+            $search[] = "{CITY_WRAPPER_CLASSES}";
+            $search[] = "{PRE_CITY}";
+            $search[] = "{CITY}";
+            $replace[] = "wpd-comment-city";
+            $replace[] = "from";  //TODO: language depended 'from'
+            $replace[] = $city;
+            $showCity = true;
+        }
+

The [code]city.html[/code] is simple as:

<div class="{CITY_WRAPPER_CLASSES}">
<span class="pre">{PRE_CITY}</span>&nbsp;{CITY}&nbsp;
</div>

My Problem now is that I did not manage to load the META-VAR {CITY} - which is saved with the comment - from the database. Both variants (see above) won't work.
How do I get the value?

Β 

...and how can I make my changes persistent without loosing them on Update/Upgrade of the Plugin? Simply copy the changes to the 'plugins' folder of my Child-Theme?

Thanks for any constructive help!


 
Posted : 18/05/2021 12:21 pm
Asti
 Asti
(@asti)
Posts: 8257
Illustrious Member Support
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@nstoeckigt,

The update safe way for this kind of customization is described here: https://wpdiscuz.com/docs/wpdiscuz-7/customization/custom-template-and-style/

I may suggest you to get the value of the city field using the $commentMetas variable in the class.WpdiscuzWalker.php file.

The meta_key you can find by editing the current field, click on the "Advanced Options" button.Β Β 

image

Here is an example:Β 

isset($commentMetas["META_KEY"][0]) ? $commentMetas["META_KEY"][0] : ""

You'll need to change the red marked part with corresponding meta_key.Β 


In case you want to say thank you! πŸ™‚
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 18/05/2021 1:29 pm
nstoeckigt reacted
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Thanks again @asti,

unfortunately this doesn't work as expected. I changed the META_KEY to 'CITY' and also applied it to older entries.

image
$city = isset($commentMetas["CITY"][0]) ? $commentMetas["CITY"][0] : "";

but it seems the Key is not in the List. I failed to `print_r` or `var_dump` the variable so I can't say for sure.

In the Database in Table `commentmeta` I see entries like

meta_id comment_id meta_key meta_value
50 9 city Dublin

Β It doesn't matter if I write the `meta_key` in upper or lower case.


 
Posted : 18/05/2021 8:41 pm
Asti
 Asti
(@asti)
Posts: 8257
Illustrious Member Support
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@nstoeckigt,

In our case the solution works fine.Β 

Could you please send the admin login details to info[at]gvectors.com email address? I'll ask the developers to check the issue.Β 


In case you want to say thank you! πŸ™‚
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 19/05/2021 1:31 pm
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@asti
I upgraded to the last recent version and pushed back my changes. When my customer checked with the results a few days later we realized that the changes in fact work as intended.

I will post a final message recompiling all my changes so others my implement the same or similar solutions.

Thanks for your help! 😍Β 


 
Posted : 28/05/2021 3:56 am
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi @ll,

finally I will summarize what I have done to archive this. It might inspire in similar situation.

Start by adding your additional Field in your Form

image

You might want to change the META-KEY under Advanced Options to something more readable to use in your code.

image

Have a look into the Database in Table `commentmeta` to see the real META-KEY because it is case-sensitive!

meta_id comment_id meta_key meta_value
50 9 city Dublin

In my case, even I wrote the META-KEY in uppercase on the Form Editor, it is saved in lowercase to the database.

Now you can start coding.

Create a Child-Theme to make all your changes update proof!

Add the following folder structure to it:

wpdiscuz/
β”œβ”€β”€ class.WpdiscuzWalker.php
└── layouts
β”œβ”€β”€ 1
β”‚Β Β  β”œβ”€β”€ author.html
β”‚Β Β  β”œβ”€β”€ city.html
β”‚Β Β  β”œβ”€β”€ header.html
β”‚Β Β  └── style.css

Create the fileΒ  city.htmlΒ  is simple as:

Β 
Create the fileΒ  header.htmlΒ  is simple as (original:Β  httpdocs/wp-content/plugins/wpdiscuz/themes/default/1/header.html):
Β 
<div class="{HEADER_WRAPPER_CLASSES}">
    {AUTHOR}
    {CITY}
    {DATE}
    {STATUS}
    {SHARE}
    <div class="wpd-space"></div>
    {LINK}
</div>
Β 
I copied the fileΒ  httpdocs/wp-content/plugins/wpdiscuz/themes/default/style.cssΒ  β†’ httpdocs/wp-content/themes/CHILD-THEME/wpdiscuz/layouts/1/style.cssΒ  and added the following lines:
#wpdcom .wpd-comment-header .wpd-comment-city{ }
#wpdcom .wpd-comment-header .wpd-comment-city .pre{font-style: italic;}
Β 
I also just copied theΒ  author.htmlΒ  but didn't modified it.
Β 
The last part isn't that difficult but a little more complex. You have do add the functionallity viaΒ  class.WpdiscuzWalker.phpΒ  which you just copy fromΒ  httpdocs/wp-content/plugins/wpdiscuz/themes/default/class.WpdiscuzWalker.php.
Β 
I added my changes just logically under the author section - here is the diff to the original one:
@@ -93,6 +93,33 @@
             $commentWrapperClass[] = "wpd-reply";
         }
 
+	$showCity = false;
+	$city = isset($commentMetas["city"][0]) ? strval($commentMetas["city"][0]) : "";
+	if ($city) {
+	    $search[] = "{CITY_WRAPPER_CLASSES}";
+	    $search[] = "{PRE_CITY}";
+	    $search[] = "{CITY}";
+	    $replace[] = "wpd-comment-city";
+	    switch( get_locale() ) {
+	      case 'de_DE':
+	          $replace[] = "aus";
+	          break;
+	      case 'fr_FR':
+	      case 'es_ES':
+	          $replace[] = "de";
+	          break;
+	      case 'it_IT':
+	          $replace[] = "da";
+	          break;
+	      case 'pl_PL':
+	          $replace[] = "z";
+	          break;
+	      default:
+	          $replace[] = "from";
+	    }
+	    $replace[] = $city;
+	    $showCity = true;
+	}
+
         $showDate = false;
         if ($this->options->thread_layouts["showCommentDate"]) {
 
@@ -429,7 +451,8 @@
             $replace[] = $content . $comment->comment_content;
             $replace[] = "wpd-comment-left " . esc_attr($commentLeftClass);
             $leftComponent = $showAvatar || $showLabel || $showFollow ? str_replace(["{AVATAR}", "{LABEL}", "{FOLLOW}"], [$showAvatar ? $args["components"]["avatar.html"] : "", ($showLabel ? $args["components"]["label.html"] : "") . apply_filters("wpdiscuz_after_label", "", $comment), $showFollow ? $args["components"]["follow.html"] : ""], $args["components"]["left.html"]) : "";
-            $headerComponent = str_replace(["{AUTHOR}", "{DATE}", "{STATUS}", "{SHARE}", "{LINK}"], [$args["components"]["author.html"], $showDate ? $args["components"]["date.html"] : "", $showStatus ? $args["components"]["status.html"] : "", $showShare ? $args["components"]["share.html"] : "", $showLink ? $args["components"]["link.html"] : ""], $args["components"]["header.html"]);
+//            $headerComponent = str_replace(["{AUTHOR}", "{DATE}", "{STATUS}", "{SHARE}", "{LINK}"], [$args["components"]["author.html"], $showDate ? $args["components"]["date.html"] : "", $showStatus ? $args["components"]["status.html"] : "", $showShare ? $args["components"]["share.html"] : "", $showLink ? $args["components"]["link.html"] : ""], $args["components"]["header.html"]);
+            $headerComponent = str_replace(["{AUTHOR}", "{CITY}", "{DATE}", "{STATUS}", "{SHARE}", "{LINK}"], [$args["components"]["author.html"], $showCity ? $args["components"]["city.html"] : "", $showDate ? $args["components"]["date.html"] : "", $showStatus ? $args["components"]["status.html"] : "", $showShare ? $args["components"]["share.html"] : "", $showLink ? $args["components"]["link.html"] : ""], $args["components"]["header.html"]);
             $footerComponent = $showVote || $showReply || $afterReplyButton || $showTools || $showToggle ? str_replace(["{VOTE}", "{REPLY}", "{TOOLS}", "{TOGGLE}"], [$showVote ? $args["components"]["vote.html"] : "", ($showReply ? $args["components"]["reply.html"] : "") . $afterReplyButton, $showTools ? $args["components"]["tools.html"] : "", $showToggle ? $args["components"]["toggle.html"] : ""], $args["components"]["footer.html"]) : "";
             $rightComponent = str_replace(["{HEADER}", "{REPLY_TO}", "{TEXT}", "{FOOTER}"], [$headerComponent, $showReplyTo ? $args["components"]["reply_to.html"] : "", $args["components"]["text.html"] . $lastEdited, $footerComponent], $args["components"]["right.html"]);
             $wrapperComponent = str_replace(["{LEFT}", "{RIGHT}"], [$leftComponent, $rightComponent], $args["components"]["wrapper.html"]);
Β 
The code is just an adoption of similar code blocks like for the author.
Β 
That's it! Have Fun and Good success!
Β 

 
Posted : 11/02/2022 1:15 am
Asti and XVanish reacted
(@nstoeckigt)
Posts: 9
Active Member
Topic starter
Translate β–Ό
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

I found an error which I can't correct in my previous Post so here is the correct folder structure within your child theme:

Add the following folder structure to it:

wpdiscuz/
β”œβ”€β”€ class.WpdiscuzWalker.php
└── layouts/
β”‚Β Β  β”œβ”€β”€ 1/
β”‚Β  Β β”‚Β  Β  Β  β”œβ”€β”€ author.html
β”‚Β Β  β”‚Β  Β  Β  β”œβ”€β”€ city.html
β”‚Β Β  β”‚Β  Β  Β  β”œβ”€β”€ header.html
β”‚Β Β  β”‚Β  Β  Β  └── style.cssΒ Β 


 
Posted : 11/02/2022 9:22 pm