vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - Widget: Latest Articles In Section (https://vborg.vbsupport.ru/showthread.php?t=232443)

iamspookysdaddy 02-12-2010 08:27 PM

Quote:

At the very top of your widget add:
PHP Code:

if($show['guest']) { 

And at the bottom add:
PHP Code:




Okay this is very good. This blocks guest from seeing....Can you please advise for code to allow certain user groups to see. Sorry I do not know code but can apply your advice.

Thank you this is a most important modifcation!

Installed and Nominated!:up:

OcR Envy 02-15-2010 10:32 PM

Quote:

Originally Posted by Neptun (Post 1980291)
thanksss that you like my idea ;)

i have changed the code now with the "read more" instead of the "(more) and have put a little center & b to this - a change the text size of the discription - it looks really perfect now

perfect hack ;) now its perfect for me ;) and it looks really professional now ;)

thx for your help ;)

Glad you like it :)

Quote:

Originally Posted by iamspookysdaddy (Post 1981018)
Okay this is very good. This blocks guest from seeing....Can you please advise for code to allow certain user groups to see. Sorry I do not know code but can apply your advice.

Thank you this is a most important modifcation!

Installed and Nominated!:up:

Thanks for the nomination that's unexpected for such a small mod :)

For usergroups you'd do something like this:

PHP Code:

if(is_member_of($vbulletin->userinfo123)) { 

Replace the guest code with that. 1, 2, 3 being the usergroup numbers. This should also work for secondary usergroups :)

iamspookysdaddy 02-18-2010 01:04 AM

Quote:

Originally Posted by OcR Envy (Post 1983333)
Glad you like it :)



Thanks for the nomination that's unexpected for such a small mod :)

For usergroups you'd do something like this:

PHP Code:

if(is_member_of($vbulletin->userinfo123)) { 

Replace the guest code with that. 1, 2, 3 being the usergroup numbers. This should also work for secondary usergroups :)


The mod is important because the CMS lacks basic needed functionality. It needs to be able to show content for specific user groups without blocking the page and displaying a no permissions screen.

However now I can not get the users or guest to function and it just displays empty box. Not sure why. Can you confirm if you are able to display content or not for specific user groups or guest???

Many thanks!!!

OcR Envy 02-18-2010 02:01 PM

Are you changing the 1, 2, 3 to match what usergroup id numbers you need?

iamspookysdaddy 02-19-2010 09:40 AM

Hi,

Yes I have tried changing to user group ideas and cannot get the guest to work either. Widget displays normally with content until I add the additonal code to display to certain groups and then the box is empty.

OcR Envy 02-26-2010 10:31 AM

Quote:

Originally Posted by iamspookysdaddy (Post 1986307)
Hi,


Yes I have tried changing to user group ideas and cannot get the guest to work either. Widget displays normally with content until I add the additonal code to display to certain groups and then the box is empty.


For those wondering I handled spooky' request privately. It seems that regardless of the conditional statement the widget block will display with blank content.

Usergroup viewing permissions for widgets seem like another obvious function that is lacking in the vbCMS. :(

Updated to 1.6
- 4.0.2 started inserting [ATTACH] into the text fields. Simply add:

Code:

    $text = preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/', '', $text);
    $text = strip_bbcode($text);

Before:

Code:

if($text == '') $text = substr($fulltext, 0,150);
And you should be good to go.

sniranjan 03-07-2010 01:29 PM

Thanks for the excellent mod.

sniranjan 03-07-2010 01:55 PM

I have vbseo installed and the links dont seem to work with.
My CMS entry for article is

en/[section_title]/[entry_title]-[entry_id].html

Can you please help with the url of the article

Thanks

sniranjan 03-07-2010 02:26 PM

Quote:

I have vbseo installed and the links dont seem to work with.
My CMS entry for article is

en/[section_title]/[entry_title]-[entry_id].html

Can you please help with the url of the article

Thanks
I just got this working with a small change:

replace

PHP Code:

$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br></center><p>".$text." <a href='content.php?".$nodeid."-".$url."'> <img alt='Read More' src='images/cms/read_more-right.png' title='Read More' border='0'></a></p><br />"

with

PHP Code:

$output .= "<a href='content.php?r=".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br></center><p>".$text." <a href='content.php?r=".$nodeid."-".$url."'> <img alt='Read More' src='images/cms/read_more-right.png' title='Read More' border='0'></a></p><br />"

Thanks

neudimenxion 03-08-2010 04:20 AM

hi,

The widget is not working. Already change the section id but the articles seem don't want to appear in the widget. what am i might be wrong?

OcR Envy 03-08-2010 12:10 PM

Quote:

Originally Posted by neudimenxion (Post 1999600)
hi,

The widget is not working. Already change the section id but the articles seem don't want to appear in the widget. what am i might be wrong?

Kinda Vague problem there. Let me see your widget code and the HTML it outputs.

neudimenxion 03-08-2010 10:54 PM

1 Attachment(s)
Quote:

Originally Posted by OcR Envy (Post 1999788)
Kinda Vague problem there. Let me see your widget code and the HTML it outputs.

Here is my widget code. My section id is 147 and the output is per attached.

// Set Your Section ID Here
$section = '147';
// Set The Number of Articles To Display
$limit = '2';
// Set The Height of The Thumbnail Image
$height = '250';
// Set The Width of The Thumbnail Image
$width = '250';

$articlegrab = vB::$db->query_read("
SELECT ".TABLE_PREFIX."cms_nodeinfo.nodeid
, ".TABLE_PREFIX."cms_nodeinfo.title
, ".TABLE_PREFIX."cms_article.previewimage
, ".TABLE_PREFIX."cms_article.previewtext
, ".TABLE_PREFIX."cms_article.pagetext
, ".TABLE_PREFIX."cms_article.contentid
, ".TABLE_PREFIX."cms_node.nodeid
, ".TABLE_PREFIX."cms_node.parentnode
, ".TABLE_PREFIX."cms_node.contentid
, ".TABLE_PREFIX."cms_node.url
, ".TABLE_PREFIX."cms_node.publishdate
, ".TABLE_PREFIX."cms_node.setpublish
FROM ".TABLE_PREFIX."cms_article
, ".TABLE_PREFIX."cms_nodeinfo
, ".TABLE_PREFIX."cms_node
WHERE (".TABLE_PREFIX."cms_nodeinfo.nodeid = ".TABLE_PREFIX."cms_node.nodeid)
AND (".TABLE_PREFIX."cms_article.contentid = ".TABLE_PREFIX."cms_node.contentid)
AND (".TABLE_PREFIX."cms_node.parentnode IN ($section))
AND (".TABLE_PREFIX."cms_node.setpublish != 0)
ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
");


while($articleinfo = vB::$db->fetch_array($articlegrab)) {

$title = $articleinfo['title'];
$image = $articleinfo['previewimage'];
$text = $articleinfo['previewtext'];
$nodeid = $articleinfo['nodeid'];
$url = $articleinfo['url'];
$unixdate = $articleinfo['publishdate'];
$date = date("F j, Y, g:i a", $unixdate);
$fulltext = strip_bbcode($fulltext);
$text = preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/', '', $text);
$text = strip_bbcode($text);


if($text == '') $text = substr($fulltext, 0,150);

$output .= '<left>';
if($image != '') $output .= "<img src='".$image."' width='".$width."px' height='".$height."px' /><br />";

$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br></center><p>".$text." <a href='content.php?".$nodeid."-".$url."'> <img alt='Read More' src='images/cms/read_more-right.png' title='Read More' border='0'></a></p><br />";
}

neudimenxion 03-08-2010 11:11 PM

Quote:

Originally Posted by OcR Envy (Post 1999788)
Kinda Vague problem there. Let me see your widget code and the HTML it outputs.

hi oCR,

Thanks for your concern. I discover what's wrong with my widget. I tick the Permission Preview in the Display Content setting. After i remove the tick it's working now. :up:

XManuX 03-09-2010 02:08 PM

Note that you can "easily" modify it to have the "best rated articles of this month"

1?) Add this in the SELECTed fields :
Code:

, ".TABLE_PREFIX."cms_nodeinfo.ratingtotal
2?) Add this condition in your request to limit results to the current month (and year) :
Code:

AND (MONTH(FROM_UNIXTIME(".TABLE_PREFIX."cms_node.publishdate))=MONTH(NOW()) AND YEAR(FROM_UNIXTIME(".TABLE_PREFIX."cms_node.publishdate))=YEAR(NOW()))
3?) Replace the ORDER part :
Code:

ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
with:
Code:

ORDER BY ".TABLE_PREFIX."cms_nodeinfo.ratingtotal DESC LIMIT $limit
4?) In the While (where all variables are initialized) :
Code:

$rating = $articleinfo['ratingtotal'];
5?) Add somewhere in the $output string definition:
Code:

<span class=\"cmsrating rating{$rating}\"></span>
Regards.

kingMOB 03-09-2010 03:26 PM

Thank you very much XManuX =) Will try it later.

Anyway to output the results in real time? Or at least weekly?

What about modify it to the most viewed articles? =)

justasiam 03-09-2010 10:36 PM

Is there any way to make this not display the content of the article, just the title with a link?

XManuX 03-10-2010 08:20 AM

Quote:

Originally Posted by kingMOB (Post 2000495)
Thank you very much XManuX =) Will try it later.

Anyway to output the results in real time? Or at least weekly?

What about modify it to the most viewed articles? =)

Results are updated each time you refresh the page. Using Ajax to refresh them without reloading the page could be cool but a huge backend would be required ...

To display most viewed instead of most rated, replace this :
Code:

, ".TABLE_PREFIX."cms_nodeinfo.ratingtotal
with :
Code:

, ".TABLE_PREFIX."cms_nodeinfo.viewcount
Then replace this :
Code:

ORDER BY ".TABLE_PREFIX."cms_nodeinfo.ratingtotal DESC LIMIT $limit
with:
Code:

ORDER BY ".TABLE_PREFIX."cms_nodeinfo.viewcount DESC LIMIT $limit
Replace:
Code:

$rating = $articleinfo['ratingtotal'];
with:
Code:

$views = $articleinfo['viewcount'];
And finally replace:
Code:

<span class=\"cmsrating rating{$rating}\"></span>
with:
Code:

&nbsp;Viewed $views times.

kingMOB 03-11-2010 08:29 AM

Worked perfectly, both modifications, thanks XManuX =)

kingMOB 03-12-2010 10:18 PM

I'm trying to modify the:

// Set Your Section ID Here
$section = '11';

so it recognizes the section where it is. Right now I have lots of latest, most popular and most viewed articles widgets for the various sections of my cms. Just one generic of each kind that could recognize the section where it is would make things a lot easier =)

Any help ? =)

rastaX 03-13-2010 06:05 PM

Quote:

Originally Posted by justasiam (Post 2000576)
Is there any way to make this not display the content of the article, just the title with a link?

Thanks for this, very nice. I am interested in doing this as well. I have deleted some code and it is working well, but I hate sloppiness. So if you could show the correct way, I would also appreciate it.

kingMOB 03-13-2010 06:14 PM

This is the code that prints the title and the link to the article:

PHP Code:

$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a> 

You just need to leave this in the end of the widget:

PHP Code:

   if($text == ''$text substr($fulltext0,150);
    
    
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br />";



Wild Bronco 03-15-2010 02:05 PM

This looks nice.

Could the photo be a link to the Article also?
I think most users would starte by clicking it to see more.

OcR Envy 03-24-2010 10:28 AM

Good stuff here guys. Thanks for supporting Manu and King, been a bit busy myself.

novabandit 03-25-2010 12:47 AM

I have this working on my homepage, and it's great!

However, is it possible for this to work in a forum sidebar block?

GRE 04-11-2010 08:26 PM

I removed "Publish Date" line and all text has a center alignment. How can that be fixed?

Neptun 06-01-2010 07:00 PM

i have a problem ...

i have no space between the pictures there is one directly next to the other and also with the text - there is no space between ....

thx for help

L2V 06-03-2010 04:51 PM

Maybe this will help somebody else (or me in case I made a mistake) but I like to set CMS articles to published at a future date/time and this widget code was still showing those even though they were not published yet. It checks for published but not WHEN it is published. Here is what I used to fix this:

Find:
Code:

// Set The Width of The Thumbnail Image
$width = '250';

Add below:
Code:

// Set the current day and time
$datenow = strtotime("now");

Find:
Code:

AND (".TABLE_PREFIX."cms_node.setpublish != 0)
Add below (before 'ORDER BY'):
Code:

AND (".TABLE_PREFIX."cms_node.publishdate < ($datenow))
Worked like a [S]champ[/S] boss.

monoco 07-23-2010 09:30 PM

Any way to make the image auto resize like the "cms article preview", instead of having to input the image size?

Neptun 07-25-2010 07:55 AM

is there a possiblity to link the pictures also to the articles with a hyperlink ?

thanks

monoco 07-27-2010 12:35 AM

Would like to be able to float the image to the left and have the text flow around the image like the way the primary content widget works.

Any suggestions??

thanasis1 12-12-2010 10:58 AM

hello all,
i need some help...
i inserted the code but the widget is empty.
i tried to create a new widget by default "Recent articles" and this is not displayed too.
is there any parameter that i have to edit in order to display the widget content?
i created another one (media library) succesfully but this is still empty.
thank you

Mark4865 02-01-2011 10:20 AM

Hello,

This widget is exactly what I need, can someone PLEASE help me with exact code needed just to show article title, link and preview image and NOTHING else.

Also I have sections with just video, if I use it in those sections with above requirements will it work???

All help greatly appreciated I am very technically challenged and need serious HELP PLEASE

Mark4865 02-05-2011 10:46 AM

hello,

I have manageed to remove some of the stuff I didnot want (publish date etc) how do I remove the "read more" image and text from what is left below. I seem to get errors with everything I try

$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /></br></center><p>".$text." <a href='content.php?".$nodeid."-".$url."'> <img alt='Read More' src='images/cms/read_more-right.png' title='Read More' border='0'></a></p><br />";
}

Mark4865 02-05-2011 02:46 PM

[QUOTE=OcR Envy;1978198]Find:

PHP Code:

    $output .= '<center>';
    if(
$image != ''$output .= "<img src='".$image."' width='".$width."px' height='".$height."px' /><br />";
    
    
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br></center><p>".$text." <a href='content.php?".$nodeid."-".$url."'>(more)</a></p><br />"

Replace with something like this:

PHP Code:

    $output .= '<div style="float: right; width:255px;">';
    if(
$image != ''$output .= "<img src='".$image."' width='".$width."px' height='".$height."px' style="floatleft;" /><br />";
    
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br><p>".$text." <a href='content.php?".$nodeid."-".$url."'>(more)</a></p><br /></div>"

Hello I tried this and it just came up as an error has anyone else got it to work with the picture on the left and text on the right??

I also only want picture and title to show, everything else removed including read more

HELP PLEASE ANYONE

Mark4865 02-11-2011 09:22 AM

Will seriously pay someone to help me get this working how I want

ANYONE PLEASE!!

nakedanvil 02-28-2011 06:18 PM

How do/did you remove publish date?

Mark4865 03-01-2011 12:59 PM

This is the code I used which removes everything but the title and the picture

// Set Your Section ID Here
$section = '1';
// Set The Number of Articles To Display
$limit = '5';
// Set The Height of The Thumbnail Image
$height = '100';
// Set The Width of The Thumbnail Image
$width = '150';

$articlegrab = vB::$db->query_read("
SELECT ".TABLE_PREFIX."cms_nodeinfo.nodeid
, ".TABLE_PREFIX."cms_nodeinfo.title
, ".TABLE_PREFIX."cms_article.previewimage
, ".TABLE_PREFIX."cms_article.contentid
, ".TABLE_PREFIX."cms_node.nodeid
, ".TABLE_PREFIX."cms_node.parentnode
, ".TABLE_PREFIX."cms_node.contentid
, ".TABLE_PREFIX."cms_node.url
, ".TABLE_PREFIX."cms_node.setpublish
FROM ".TABLE_PREFIX."cms_article
, ".TABLE_PREFIX."cms_nodeinfo
, ".TABLE_PREFIX."cms_node
WHERE (".TABLE_PREFIX."cms_nodeinfo.nodeid = ".TABLE_PREFIX."cms_node.nodeid)
AND (".TABLE_PREFIX."cms_article.contentid = ".TABLE_PREFIX."cms_node.contentid)
AND (".TABLE_PREFIX."cms_node.parentnode IN ($section))
AND (".TABLE_PREFIX."cms_node.setpublish != 0)
ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
");

while($articleinfo = vB::$db->fetch_array($articlegrab)) {

$title = $articleinfo['title'];
$image = $articleinfo['previewimage'];
$nodeid = $articleinfo['nodeid'];
$url = $articleinfo['url'];
$fulltext = strip_bbcode($fulltext);
$text = preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/', '', $text);
$text = strip_bbcode($text);

if($text == '') $text = substr($fulltext, 0,150);

$output .= '<center>';
if($image != '') $output .= "<img src='".$image."' width='".$width."px' height='".$height."px' /><br />";

$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /></br></center><p>".$text." </p><br />";
}

nakedanvil 03-01-2011 07:59 PM

Thanks Mark, worked great. Just what I've been looking for.

Mark4865 03-03-2011 01:41 PM

perfect glad I could actually help someone

Mark4865 03-05-2011 12:28 PM

Hello,

I have this mod install using above code that I changed a bit to remove everything but thumbnail and title, works fantastically, thanks to orignal coder.

Can anyone tell me how to get the pictures on the left and title on the right using same modified code above PLEASE


All times are GMT. The time now is 02:38 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01510 seconds
  • Memory Usage 1,885KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (20)bbcode_code_printable
  • (10)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete