Thread: Opt-Out
View Single Post
  #7  
Old 03-16-2010, 11:22 PM
TalkVirginia's Avatar
TalkVirginia TalkVirginia is offline
 
Join Date: Oct 2008
Location: Virginia
Posts: 545
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's what I got so far:

I have a custom field set up in the usercp under General Settings as shown in the attached image.

I was planning to have a field in my mod configuration screen where the field name of the custom user field would go so I know where to pull info from.

Then on the sent email I was planning to include an unsubscribe url like:

Code:
mydomain.com/reminderemails.php?do=unsubscribe&email=johnsmith@somedomain.com
I wanted to set a field in the vb_user table to indicate they unregistered but then I realized I also needed to programmatically change the value in the userfields table so the custom field value in the usercp would reflect the optout.

I saw in the profile.php script where the set_userfields method in the userdata object to set the custom fields like so:

PHP Code:

// custom profile fields
    
$userdata->set_userfields($vbulletin->GPC['userfield']); 
I also googled set_userfields and found in the vb.org archives that I should be able to use this method to set a specific custom field:

PHP Code:

// change ## to the number of the custom field, 
// and fieldvalue to the value you want

$fieldvariable = array('field##' => "fieldvalue");
$userdata->set_userfields($fieldvariabletrue'admin'); 
I'm not sure what the other parameters do though. I guess my question is does this sound like a viable solution or would there be a better way? Is there any way to use numeric values for the data in the table? The drawback to using a custom field is that I don't have any control of it programmatically. If there was a template hook where I could insert a custom template at the end of the General Settings template using a plugin that might work.

Sorry if I'm rambling... just trying to provide as much information as I can.

Anyone got any thoughts on this?
Attached Images
File Type: jpg 3-16-2010 7-48-40 PM.jpg (17.8 KB, 0 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01261 seconds
  • Memory Usage 1,800KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete