The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
||||
|
||||
Dear kh99, i am sorry, so is it like this
Quote:
or this one Quote:
i tried both got error message like this Parse error: syntax error, unexpected '=' in /home/username/public_html/profile.php(156) : eval()'d code on line 22 |
#12
|
|||
|
|||
No, just the one change, like this:
Code:
if ($_POST['do'] == 'updateprofile') { $vbulletin->input->clean_gpc('p', 'userfield', TYPE_ARRAY); $fieldcontentbefore = array( 'aaa', 'ccc' ); $fieldcontentafter = array( 'bbb', 'ddd' ); $vbulletin->GPC['userfield']['fieldX'] = str_replace($fieldcontentbefore, $fieldcontentafter, $vbulletin->GPC['userfield']['fieldX']); } Where you replace the 2 occurrences of 'fieldX' with the real field name that you want to change. Quote:
Code:
$fields = array('field4', 'field7', 'field8'); foreach ($fields AS $field) { $vbulletin->GPC['userfield'][$field] = str_replace($fieldcontentbefore, $fieldcontentafter, $vbulletin->GPC['userfield'][$field]); } |
#13
|
||||
|
||||
Dear kh99, thank you for explaining it again, but its looks like still not working
Quote:
is it working in your vbulletin test? if needed i can give a vb3 test site access |
#14
|
|||
|
|||
Well, I have a vb3 test site, but I haven't actually tried this code. But now I see that I've misled you again with another mistake. The last line should be:
Code:
$vbulletin->GPC['userfield']['field1'] = str_replace($fieldcontentbefore, $fieldcontentafter, $vbulletin->GPC['userfield']['field1']); ETA: ...and that seems to work for me. I used 'field4' (Occupation) and when I edited my details and put in "aaa" it was set to "bbb". Also, that will obviously only work if the entire sting matches. If you want substrings, I think this should work: Code:
if ($_POST['do'] == 'updateprofile') { $vbulletin->input->clean_gpc('p', 'userfield', TYPE_ARRAY); $fieldcontentbefore = array( '/aaa/', '/ccc/' ); $fieldcontentafter = array( 'bbb', 'ddd' ); $vbulletin->GPC['userfield']['field1'] = preg_replace($fieldcontentbefore, $fieldcontentafter, preg_quote($vbulletin->GPC['userfield']['field1'], '/')); } Note the before array needs '/' before and after the string to be matched. |
#15
|
||||
|
||||
Gorgeus!! many thanks kh99!!
i recommend release a mod for it we already have global replacement variable we already have replacement in postbit and this one is replacement in profile field |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|