Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Problem with Recent Posts Widget from Template Tags Plugin
Avatar
Roberto Villabona
Member
sp_UserOfflineSmall Offline
Oct 2, 2015 - 2:55 pm

Hello,

I recently found a problem with the Recent Posts widget from the Template Tags plugin.

The problem occurs when I try to enter HTML code in the form for "Before Forum Text:", "Before Topic Text:", "Before User Text:", etc. etc.  What I'm trying to do is to enclose the actual label texts inside a span with their own class declarations so I can format those labels separately using CSS.  In the example below, I typed the following entries in each of the succeeding "Before" entry fields:

<span class="fp-spwidget-forum-text">Forum:</span>
<span class="fp-spwidget-topic-text">Topic:</span>
<span class="fp-spwidget-user-text">By:</span>
<span class="fp-spwidget-date-text"> - </span>

The problem occurs when I save my input.  While the text I entered is saved (confirmed by loading the website which showed the expected result), the widget seems to remove part of what I inputted once it refreshes after saving (see screen caps below) and part of the input I entered becomes part of the widget's parameter entry form and messes up its display.  Worse, if I save that again the text saved is what's left in the input box so in effect the original contents are replaced even if no edit to them actually took place.

From what I can see, it appears that the presence of double quotes (") in the entry fields messes up how the widget reads the entered values.

The screen caps are below: the first one is before I pressed "Save" while the second one is after I pressed "Save".

sp-recent-forum-posts-beforesave.pngImage Enlargersp-recent-forum-posts-aftersave.pngImage Enlarger

Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Oct 2, 2015 - 3:59 pm

I don't think I've ever looked into the recent posts widget to deeply, so I might be wrong but it looks to me like you're not going to be able to do it that way due to the fact that it's essentially putting HTML / CSS inside PHP - The double quotes are going to cause problems as well as other syntax.

If you want to make those kind of changes, you'll need to add the function directly to a text widget inside PHP tags. Check out the Recent Posts Template Tag page - You can add the function to the widget in the same way you would add a function to a template (see SP templates for examples if you're not sure) and It gives you arguments you can use to give each element it's own class so you can style individually.

Avatar
Roberto Villabona
Member
sp_UserOfflineSmall Offline
Oct 2, 2015 - 6:46 pm

Hi Ike,

I understand I can use the template tags equivalent, but I think that should at least  be considered a bug if the widget accepts and saves the input (which it does, because I verified that what I type in got through) but cannot effectively re-display what it accepted.  I also tried inputting some more variations of some text and saw that anything after "class=" is what gets cut off when the widget refreshes in the Appearance>Widget menu.

I tried doing something similar to the widget title area and got no errors.  Which means that it is done correctly in another field which does something very similar within the same widget.

This is quite similar to an old bug (apparently already fixed with the latest version) in a previous version of SP that's still on my production server (SP v.5.3.4) -- that's where the "Allowed WP shortcodes in posts:" field in Options>Content Settings would incorrectly display the list of shortcodes that were correctly inputted. The original input would be one line per shortcode but when you reload that forum admin page it'll show all shortcodes you entered on one line with each shortcode delimited by the letter 'n'.  I'm guessing that somewhere the '
' that was saved as input got converted to 'n' when redisplayed.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 3, 2015 - 1:17 am

I will open a ticket to get it looked at and see if there is a problem...  It should work with html - even our defaults include html... but possible a wrong filter is used on display in admin...

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 3, 2015 - 11:43 am

looks like there is a display vs edit filter issue here...  will get it fixed up in the next version... if goes well, might be able to get it out this weekend...

Avatar
Roberto Villabona
Member
sp_UserOfflineSmall Offline
Oct 3, 2015 - 1:19 pm

Thanks!  Meanwhile I was just getting around the problem by saving my input in a text file and copy pasting them into the widget whenever I have to change something.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 3, 2015 - 1:35 pm

just need to see if I can complete testing on it... Andy is on vacation for another week or so, which means a bit short handed around here...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17366
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626