vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Plugin PHP help (https://vborg.vbsupport.ru/showthread.php?t=261517)

HMBeaty 04-06-2011 08:04 AM

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 :D

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 :)

Lynne 04-06-2011 07:50 PM

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?

HMBeaty 04-06-2011 07:56 PM

Quote:

Originally Posted by Lynne (Post 2181643)
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. :confused:

Lynne 04-06-2011 08:00 PM

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?

HMBeaty 04-06-2011 08:03 PM

Quote:

Originally Posted by Lynne (Post 2181649)
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

Eric 04-06-2011 09:36 PM

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']);
            }
        }
    } 


HMBeaty 04-06-2011 10:10 PM

Quote:

Originally Posted by Eric (Post 2181689)
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

HMBeaty 04-06-2011 10:25 PM

1 Attachment(s)
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

Eric 04-06-2011 10:36 PM

1 Attachment(s)
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.

HMBeaty 04-06-2011 10:49 PM

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


All times are GMT. The time now is 01:14 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.01240 seconds
  • Memory Usage 1,798KB
  • 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
  • (2)bbcode_code_printable
  • (11)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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