The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
display last written blog article
Hi,
I want to display the last written blog article on the top of my forum. The information is in the template 'FORUMHOME' under: {vb:raw template_hook.forumhome_wgo_stats} but in there i get all the data I don't need also (number of blog, articles in the last 24h ). So I need to know where can I extract the exact data I need. Thanks |
#2
|
|||
|
|||
That's a good question - took me a while to figure it out. But the code that sets the blog stats on the forum home page is in the plugin "Forum Home: Process Blog Stats" (in the "Product : vBulletin Blog" section under the Plugin Manager).
|
#3
|
|||
|
|||
I found it , but how do I extract the last article tilte and who wrote it?
I tried : 1. vB_Template:reRegister('FORUMHOME',array( 'last_article' => $latestentry['blogtitle'] )); 2. $template_hook['last_article'] = $latestentry['blogtitle']; |
#4
|
|||
|
|||
Here's the structure of $vbulletin->blogstats, with junk from my test server.
Code:
Array ( [lastentry] => Array ( [username] => Kevin [userid] => 1 [title] => fdsasdfafsda [blogid] => 1 [categories] => [postedby_username] => Kevin [postedby_userid] => 1 [blogtitle] => [guestcanview] => 1 ) [total_blog_users] => 1 [total_blog_entries] => 1 [entries_in_24hours] => 1 ) So you probably want something like: require_once(DIR . '/includes/blog_functions_shared.php'); Code:
if (is_array($vbulletin->blogstats) AND is_array($vbulletin->blogstats['lastentry'])) { $user = $vbulletin->blogstats['lastentry']['username']; $userid = $vbulletin->blogstats['lastentry']['userid']; $title = $vbulletin->blogstats['lastentry']['title']; $url = '<a href="' . fetch_seo_url('entry', array('blogid' => $vbulletin->blogstats['lastentry']['blogid'], 'title' => $title)) . "\">" . $title . '</a>'; } |
#5
|
|||
|
|||
thanks kh99,
1. i think you have a mistake in the $title = $user = .. row (don't know why you did that). 2. I am trying to also get the user link to his profile I tried several ways (non worked ): $link = 'http://www.s-maof.com/members/' . urlencode( $userid. '-'. preg_replace("/ /","-",$user)); $userlink = '<a href="'. $link . '" \>' . $user . '</a>'; i'm sutre there is an easier way.. |
#6
|
|||
|
|||
Quote:
Quote:
What I posted was just meant to be some examples of getting the info, some of which might be useful. If you're trying to make a link to the user, maybe this: Code:
$userlink = '<a href="' . fetch_seo_url('member', array('userid' => $userid, 'username' => $user)) . '"/>' . $username . '<a/>'; (Sorry for any typos - I haven't actually tried this code). |
#7
|
|||
|
|||
thanks, kh99, it works,
but instead of the $username , you have to use $user according to this thread example. So the whole plug in looks like this, PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|