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
Post rating totals remove the minus sign.
Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
Oct 21, 2012 - 4:56 pm

Hi, I'm trying to use the post rating in a bit of a different way, not thumbs up or down, but love this and sorry to hear that kind of thing. I've been able to change the words shown and the icons, however I'd love to get rid of the -2 and just show the total for the "thumbs down". Is there any way to display the numbers in the positive? I know it will be a negative in database but thought there might be a way to show only the number.

Thanks for any help with this.

 Shari  

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 21, 2012 - 7:08 pm

you didnt say which display of posting rating you wanted to change (forum view or topic view)... so assuming its topic view, you can use the filter 'sph_PostIndexRatePost' to affect the display and strip and minus (-) signs... If you meant forum view, the filter would be 'sph_spTopicIndexRating'

Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
Oct 21, 2012 - 11:41 pm

I'd want to do it in both however I couldn't ever get it to display properly, so maybe it isn't possible.

Thanks anyway!

 Shari  

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 22, 2012 - 9:20 pm

can you share what you did?  maybe we can help...  when you filter, you would want to strip or replace the - sign with php function str_replace()...

or maybe I am not understanding what you want to do...  I understood you to say you wanted to remove the - sign from negative numbers...

Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
Oct 22, 2012 - 10:34 pm

I did try a replacement, and it replaced the - in the image url as well so that didn't work. I also tried to return the absolute value, but that didn't work at all. So unless there is a way to apply the replacement more specifically or possibly I didn't do the abs correctly, and that's why it returned nothing, I don't think it will work.

I don't fully understand php so it's possible I didn't code it correctly.

 Shari  

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 23, 2012 - 9:55 am

What is the actual string of text you need to change? And change to what?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
Oct 23, 2012 - 10:34 am

I couldn't find anyway to actually change the text without manually changing it in the code of the plugin. What I was trying to do is remove the - (minus) sign, and the + (plus) sign from the number, so it would just show the number.

We have a very personal site and people share, so we really didn't want thumbs up or down, but; I love this, and In support. I've changed the icons to a heart and a candle. I was able to do all of that. But would now like the "votes" to just show as whole numbers. I know in actuality the candle or thumbs down is a negative, but would like it to show up without the - (minus) in front of it. The plus sign doesn't really matter.

So in effect I've changed the text from reading Rate this post up to Love this and Rate this post down to sending support

I've changed the thumb up icon to a heart and the thumbs down to a candle.

Now when people have used the candle and someone looks at the topic it says current post -2 I'd prefer to remove the - from that.

So in effect we are not really using this as a rating system, but more like a facebook like, we wanted to also include the "in support" which is something people ask for all the time on facebook too. When you read someone has lost someone, you don't really want to click their like button, but want to send them a thinking of you, or in support type thing. That's what we are trying to do with your ratings plug in.

I know I'm using the plugin completely outside of the way it's intended. I know that I'm "hacking" it. Because I don't really know or understand php, I don't know what is easy versus what is difficult. It looks like a fairly complex plugin. Because I never know what is easy, I ask if something can be done. It seems like this isn't so I appreciate you're trying to help me out.

I am thinking however that this might be something to think about for the future laugh. For quite a few of the forums I run we would prefer something more like this, then a standard rating system. Where people can say they like what was written, or that they are sorry to read what was written. It's more or less saying to the person that wrote the post, I read this even through I didn't respond in writing. So possibly taking this plugin and editing the thumbs part for easily manipulation via hooks, and only showing whole number. So there, you now have my wishlist for this plugin cool

I appreciate all that all of you do, and am just happy to have SimplePress and this forum.

Thanks!

 Shari  

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 23, 2012 - 11:29 pm

something like this:

add_filter('sph_PostIndexRatePost', 'my_rating_filter', 10, 2);
function my_rating_filter($out, $a) {
    $out = str_replace('>-', '>', $out);
    return $out;    
}

should do the trick...  if you find its changing other things, we can change the str_replace() to a preg_replace() for better pattern matching...

Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
Oct 24, 2012 - 11:21 am

Thank you! Yep that did it and it didn't replace it in the url for the icon.

You rock!

 Shari  

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 24, 2012 - 12:14 pm

Good news. thanks for the update.

andy-signature.png
YELLOW
SWORDFISH
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: 17367
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626