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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-06-2011, 08:04 AM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugin PHP help

Ok, so I've been playing around with tearing a few modifications apart and trying to make it to where you have to have a minimum number of posts to post links in signatures. But, I'm a little stuck lol. This is what I have in my plugin so far. Hook location: profile_updatesignature_start
PHP Code:
$pagetext =& $this->fetch_field('pagetext''post');
$excludedugs explode(","$vbulletin->options['usml_siglink_exug']);
        if (!
is_member_of($vbulletin->userinfo$excludedugs))
        {
        if (
$vbulletin->options['usml_siglink_enable'] && $vbulletin->userinfo['posts'] < $vbulletin->options['usml_siglink_minposts'])
        {
        if (
stristr($pagetext,'http://') || stristr($pagetext,'www.') || stristr($pagetext,'@') || stristr($pagetext,'[URL') || stristr($pagetext,'[url') || stristr($pagetext,'.com') || stristr($pagetext,'.org') || stristr($pagetext,'.net') || stristr($pagetext,'.gov') || stristr($pagetext,'.biz') || stristr($pagetext,'.info') || stristr($pagetext,'.tv'))
        {
        
standard_error(fetch_error('usml_siglink_msg'$vbulletin->userinfo['username'], $vbulletin->options['usml_siglink_minposts'], $vbulletin->userinfo['posts']));
        }
        }
        } 
Apparently what I have doesn't work. All I get is a blank white page. So a variable must be wrong and/or some additional code is needed, which I'm not sure what it is, or if the above is even correct to start with. So any guidance you can give me will be greatly appreciated

Thank you

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

Ok, quick update. There was an extra space in a bit of the code, so I removed that and now my signature gets saved again and I can still post links in the signature. So, now I need help trying to figure out what I need to add/edit/move to make it where users can't post links in their signatures until they reach a certain post count.

Thank you
Reply With Quote
  #2  
Old 04-06-2011, 07:50 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So this isn't working?
PHP Code:
$vbulletin->userinfo['posts'] < $vbulletin->options['usml_siglink_minposts'
Have you tried printing out those variables to see what is up with them?
Reply With Quote
  #3  
Old 04-06-2011, 07:56 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
So this isn't working?
PHP Code:
$vbulletin->userinfo['posts'] < $vbulletin->options['usml_siglink_minposts'
Have you tried printing out those variables to see what is up with them?
Well, I'm pretty sure that works, as I've used code very similar to that before, but other than that, I'm not sure what I'm doing wrong. As it is, I would think it should work just fine.
Reply With Quote
  #4  
Old 04-06-2011, 08:00 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Right now, I look at your plugin and you are performing operations on the variable $pagetext. I thought you wanted to do stuff to the signature? Shouldn't that be a different variable name?
Reply With Quote
  #5  
Old 04-06-2011, 08:03 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Right now, I look at your plugin and you are performing operations on the variable $pagetext. I thought you wanted to do stuff to the signature? Shouldn't that be a different variable name?
Now THAT is what I'm definately not sure of. Again, I pulled a couple of other modifications apart, basically combining them and reworking them, and ended up with this. So I'm not even sure which variable I need to use in place of that if anything at all...

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

Ok lol, I've tried:
PHP Code:
$pagetext =& $this->fetch_field('signature''post'); 
and
PHP Code:
$pagetext =& $this->fetch_field('updatesignature''post'); 
and
PHP Code:
$pagetext =& $this->fetch_field('modifysignature''post'); 
And none of those seem to work, so apparently I'm still using the wrong variable lol
Reply With Quote
  #6  
Old 04-06-2011, 09:36 PM
Eric's Avatar
Eric Eric is offline
 
Join Date: May 2006
Location: Kentucky
Posts: 792
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Given the location of that hook, shouldn't you be able to use $signature ?

From profile.php:
PHP Code:
    // DO WYSIWYG processing to get to BB code.
    
if ($vbulletin->GPC['wysiwyg'])
    {
        require_once(
DIR '/includes/functions_wysiwyg.php');

        
$signature convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $permissions['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['allowhtml']);
    }
    else
    {
        
$signature $vbulletin->GPC['message'];
    }

    (
$hook vBulletinHook::fetch_hook('profile_updatesignature_start')) ? eval($hook) : false;

    
// handle image uploads 
So, couldn't you use something like this:

PHP Code:
    $excludedugs explode(','$vbulletin->options['usml_siglink_exug']);

    if (!
is_member_of($vbulletin->userinfo$excludedugs))
    {
        if (
$vbulletin->options['usml_siglink_enable'] AND $vbulletin->userinfo['posts'] < $vbulletin->options['usml_siglink_minposts'])
        {
            if (
stristr($signature'http://') OR stristr($signature'www.') OR stristr($signature'[URL'))
            {
                
$errors[] = fetch_error('usml_siglink_msg'$vbulletin->userinfo['username'], $vbulletin->options['usml_siglink_minposts'], $vbulletin->userinfo['posts']);
            }
        }
    } 
Reply With Quote
  #7  
Old 04-06-2011, 10:10 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Eric View Post
Given the location of that hook, shouldn't you be able to use $signature ?

From profile.php:
PHP Code:
    // DO WYSIWYG processing to get to BB code.
    
if ($vbulletin->GPC['wysiwyg'])
    {
        require_once(
DIR '/includes/functions_wysiwyg.php');

        
$signature convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $permissions['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['allowhtml']);
    }
    else
    {
        
$signature $vbulletin->GPC['message'];
    }

    (
$hook vBulletinHook::fetch_hook('profile_updatesignature_start')) ? eval($hook) : false;

    
// handle image uploads 
So, couldn't you use something like this:

PHP Code:
    $excludedugs explode(','$vbulletin->options['usml_siglink_exug']);

    if (!
is_member_of($vbulletin->userinfo$excludedugs))
    {
        if (
$vbulletin->options['usml_siglink_enable'] AND $vbulletin->userinfo['posts'] < $vbulletin->options['usml_siglink_minposts'])
        {
            if (
stristr($signature'http://') OR stristr($signature'www.') OR stristr($signature'[URL'))
            {
                
$errors[] = fetch_error('usml_siglink_msg'$vbulletin->userinfo['username'], $vbulletin->options['usml_siglink_minposts'], $vbulletin->userinfo['posts']);
            }
        }
    } 
I tried that too, but no luck
Reply With Quote
  #8  
Old 04-06-2011, 10:25 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's the product if anyone wants to play around with it and let me know what you can come up with....

Just import. No file or template edits needed
Attached Files
File Type: zip product-usml_minpost_siglink.zip (1.7 KB, 5 views)
Reply With Quote
  #9  
Old 04-06-2011, 10:36 PM
Eric's Avatar
Eric Eric is offline
 
Join Date: May 2006
Location: Kentucky
Posts: 792
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The code I posted works for me

Attachment 127981

What I tried entering for the sig (without the spaces in the URL bbcode):
Code:
This is a [ url=http://test.com]test[/url ] - test.
Reply With Quote
  #10  
Old 04-06-2011, 10:49 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, yes, it works if you put in a regular url. Now, how do I make it so if a user tries to "go around" by using say....
Code:
vbulletin.com
it would throw the same error. I figured I could do that with the
PHP Code:
OR stristr($signature'.com'
part of the code, but no luck. Or is that even possible?

EDIT: Thank you for you help too
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 12:53 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.04413 seconds
  • Memory Usage 2,331KB
  • Queries Executed 14 (?)
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
  • (2)bbcode_code
  • (11)bbcode_php
  • (3)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
  • (1)postbit_attachment
  • (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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete