Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-11-2013, 02:37 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Showing Author Avatar in Articles

Hi all

I used this nice plugin to show author avatar in the articles.
http://www.vbulletin.com/forum/forum...o-cms-articles

The problem is, I don't want to show avatars in all articles, but only on opinion articles and reviews, but for news articles no avatars at all.

I thought in this problem, and then added a custom field to the articles to show or not show user avatars, I followed this nice article (guide)
https://vborg.vbsupport.ru/showthread.php?t=257589
Actually I did the first 4 points, and it seems work great (changing and saving every time), but I don't complete the steps.

What I want know, is how I can use my new field to control the plugin that shows avatars?

let we say the new field named showavatar.

Sorry but I'm very new in coding vb4 and vbcms

Thanks in advance
Reply With Quote
  #2  
Old 04-11-2013, 03:40 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If the new field is called showavatar, then grab the variable at the beting of your show author avatar plugin and then use it in a condition:

PHP Code:
if ($showavatar) {
code here to show avatar

Reply With Quote
  #3  
Old 04-12-2013, 02:21 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for your appreciate help.

How I can grab the variable Lynne?
Reply With Quote
  #4  
Old 04-12-2013, 03:23 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You didn't really say where you added it, so I don't really know. You probably have to do a query unless the variable is already there. I really can't tell since you have posted no code or anything.
Reply With Quote
  #5  
Old 04-12-2013, 05:57 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you Lynne for your reply.

I want to display the avatars in both article page and section page (article preview).
By technical words I want to display avatar in "vbcms_content_article_page" and "vbcms_content_article_preview" templates, and now without the condition the avatars shows very well, but as I said before I don't want to show avatars for all articles.

Here is the code that reefland added in vb.com
PHP Code:
require_once(DIR '/includes/functions_user.php');

$avatarurl fetch_avatar_url($this->content->getUserId());
if (
$avatarurl[0]) {
$avatarurl $avatarurl[0];
}
/* render template and register variables */
vB_Template::preRegister('vbcms_content_article_page',array('avatarurl' => $avatarurl)); 
I just added this line to it to let avatars appear also in section page
PHP Code:
vB_Template::preRegister('vbcms_content_article_preview',array('avatarurl' => $avatarurl)); 
Any suggestions?

BTW, regarding to this article, https://vborg.vbsupport.ru/showthread.php?t=257589
I try to complete the steps to show another field in articles, but I get error 500 when adding the plugin in step 9 !!

Waiting for your help Lynne , and thanks in advance.
Reply With Quote
  #6  
Old 04-12-2013, 07:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And what hook location did you use for the $avatarurl code? Perhaps that hook isn't used on the section page. Also, you can't just preregister the variable, you also need to actually add that variable to the template you preregistered it for use in.
Reply With Quote
  #7  
Old 04-12-2013, 08:15 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I put the code in the hook as this thread says
http://www.vbulletin.com/forum/forum...o-cms-articles
"vbcms_article_populate_end".

As I told you, now without conditions the avatars appears in both pages (article page and section page).

--------------- Added [DATE]1365811144[/DATE] at [TIME]1365811144[/TIME] ---------------

Is there any suggestion?
Reply With Quote
  #8  
Old 04-12-2013, 10:51 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You said:
Quote:
What I want know, is how I can use my new field to control the plugin that shows avatars?
So, what is this new field - what is it called and where is it in the database (table.field)? And have you done anything in the plugin to make sure it is available for you to use?
Reply With Quote
  #9  
Old 04-12-2013, 11:13 PM
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Location: Libya
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The new field as I told you in the previous post named "showavatar", and it added to cms_node table.

I did every thing in this plugin
http://www.vbulletin.com/forum/forum...o-cms-articles
and it is work as charm, but I want now to use my showavatar field to show/hide avatars.

--------------- Added [DATE]1365815805[/DATE] at [TIME]1365815805[/TIME] ---------------

As I told you, I'm new with vb4 and vbcms, I'm just coming from days of vb3, so every thing is new for me and I'm confused a little bit, I want to use my field value (1 or 0) to control the whole process, but I want to declare the showavatar in the plugin before I can use it in the condition, but I don't know how I can do this .

--------------- Added [DATE]1365815898[/DATE] at [TIME]1365815898[/TIME] ---------------

The plugin now without the condition works great, just to clear the picture .
Reply With Quote
  #10  
Old 04-13-2013, 02:04 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you added it to that table, did you also modify the query that grabs fields from that table to make sure to grab that field?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:58 AM.


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.06700 seconds
  • Memory Usage 4,732KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete