On these pages are my WordPress plugins, the odd article and my Support Forum.

For my random rantings on everything else please visit my blog at Yellow Swordfish

WP Plugins


Articles

If you find any of my plugins useful, please comsider a donation towards my running costs.

Thank you

In preparation for the release of Simple:Press Version 4.0, the Support Forum has moved to a new site dedicated to the plugin. This will also be the future home for Simple:Press Forum.


Version 3.1.4 will still be available for download here in the short term.


For the support forum - and to visit our new site and to get details of version 4.0, click on the logo to take you to simplepressforum.com

This forum is currently locked - access is read only
Current User: Guest
Please consider registering

 
Search Forums:


 




Help with sf_author_posts Tag

UserPost

3:34 pm
27 Jun 2008


kbevington

Member

posts 20

1

Putting this tag into my front page, multiple times for multiple authors… It works great, except, is there a way to limit what it returns to say the last 2 posts?

I am aware of the sf_latest_posts_expanded tag (have not used it), can the author tag be expressed in a similar way?

Thx

Kevin

2:50 am
28 Jun 2008


kbevington

Member

posts 20

2

any help with this would sure be appreciated!


Thx

Kevin

3:13 am
28 Jun 2008


Mr Papa

Moderator

Arizona, USA

posts 1602

3

not currently, but if you are not afraid of a little bit of php, you can make a slight mod to the tag…

in sf-tags.php, line 373 change

function sf_author_posts($author_id, $showforum=true, $showdate=true)

to

function sf_author_posts($author_id, $showforum=true, $showdate=true, $limit=0)

and then change line 383

    $sql = “SELECT DISTINCT post_id, forum_id, topic_id, post_date, post_index FROM “.SFPOSTS.” WHERE user_id = $author_id ORDER BY post_date DESC”;   

to

if ($limit > 0)
{
$limit = 'LIMIT '.$limit;
} else {
$limit = '';
}
$sql = “SELECT DISTINCT post_id, forum_id, topic_id, post_date, post_index FROM “.SFPOSTS.” WHERE user_id = $author_id ORDER BY post_date DESC $limit”;

Then just add another parameter at the end of the call to the tag with the desired number of posts to be returned…  A value of zero means return all posts for the author id… 

Or you could just replace the

DESC $limit in my above with DESC LIMIT 2 for your example… just depends on how flexible you want to be…

Please note, I havent tested the code I just entered, but it should get you close if not what you want…  If you prefer, you can PM me and I can mod the file and send it to you if you like… 

I will also open a ticket to get the tag modified with this change for the next release as its a pretty good idea..

11:47 am
28 Jun 2008


kbevington

Member

posts 20

4

Sent a pm…


Thanks

Kevin

12:16 pm
28 Jun 2008


Mr Papa

Moderator

Arizona, USA

posts 1602

5

replied and emailed you a file…  let me know how it works…



Reply to Topic: Help with sf_author_posts Tag

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 7 + 10        (Required)

Topic Reply:


 
 

About the Stuff at Yellow Swordfish forum

Currently Online:

11 Guests

Maximum Online: 71

Forums:

Groups: 3

Forums: 16

Topics: 2068

Posts: 14091

Members:

There are 1003 members

There are 837 guests


Yellow Swordfish has made 5252 posts

Top Posters:

Mr Papa - 1602

-Radio- - 558

ovizii - 114

jfv - 82

angelic007 - 72

Administrator: Yellow Swordfish | Moderators: Yellow Swordfish, Mr Papa, -Radio-


© Simple:Press Forum - Version 3.1.4 (Build 357)