Results 1 to 5 of 5

Thread: Opt Out Link Problem

  1. #1
    miles120 is offline Junior Member
    Join Date
    Mar 2009
    Posts
    2

    Default Opt Out Link Problem

    Everyone,

    I have created a number of click-thru links for my e-mail template, including one opt-out link. The URL given to me for the template is: http://www.mydomain.com/sugarsd/index.php?entryPoint=removeme&identifier={MESSAGE_ ID}. When I click on the link in my test e-mail, it takes me to the server and tells me that I've opted out, but doesn't record the click-thru and doesn't place me in the unsubscribe list.

    It looks like the URL is supposed to contain a variable message-id in the place of {MESSAGE_ID}. Did I insert the URL into the template improperly?

    Thanks,

    Michael

  2. #2
    matthew's Avatar
    matthew is offline Sugar Team Member
    Join Date
    Jul 2005
    Posts
    533

    Default Re: Opt Out Link Problem

    I'm sorry I can't speak to exactly why this is happening, but my recommendation is to log numerous statements that will allow you to figure out exactly what's going on.

    you can set your logging to FATAL in the admin settings screen

    then you can add logging lines like this:

    $GLOBALS['log']->fatal("your debug statement");

    I use fatal, so that it keeps the noise down from all the other logging lines.

    then you can insert those into various places to understand the behavior of the code.

    The files you should target are ones like:

    ./modules/Campaigns/utils.php -> specifically in the function unsubscribe

    and also in

    ./modules/Campaigns/RemoveMe.php

    Hope this helps

    Sugar University for training
    Sugar Wiki for developer and user help
    SugarForge for modules, themes, lang packs
    SugarExchange for production-ready extensions
    Enter/view bugs via the Sugar bug tracker

  3. #3
    nagaraju2009 is offline Junior Member
    Join Date
    May 2009
    Location
    India
    Posts
    1

    Default Re: Opt Out Link Problem

    Dear All,

    Subj: Multiple Leads to be Unsubscribed having same Email Address

    We have created three different lead records with the same email address. But when we unsubscribe manually or with the campaign unsubscribe link, it only unsubscribe one respective record, but not the other records whereas the opt-out status is being updated. We require all the three records to be opted-out and unsubscribed.

    It would be great if you give us the information to solve this issue.

    SugarCRM Version: Sugar520f
    OS: Linux

    Regards,
    Nagaraju.

  4. #4
    kenneth.thorman is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    191

    Default Re: Opt Out Link Problem

    I know this is a late reply but I just ran into the same bug myself.

    Basically what I found what that the "URL for Campaign Message:" in the

    index.php?module=CampaignTrackers&action=DetailVie w

    seems to be wrong (bug).

    This is based on some pretty old code 5.1.0b but it seems like this might still be there based on your description of your problem.

    Basically the problem is that the logic doing the text search and replace uses a different kind of logic than the
    index.php?module=CampaignTrackers&action=DetailVie w.

    Break down of my findings follow:

    file: modules/EmailTemplates/EmailTemplate.php
    function: parse_tracker_urls

    (in my version of the code line 329-344)

    PHP Code:
    //navigate thru all the matched keys and replace the keys with actual strings.
    for ($i=($count -1); $i>=0$i--) {
        
    $url_key_name=$matches[0][$i][0];

        if (!empty(
    $tracked_urls[$url_key_name])) {
            if (
    $tracked_urls[$url_key_name]['is_optout']==1){
                
    $tracker_url $removeme_url_template;
            } else {
                
    $tracker_url sprintf($url_template,$tracked_urls[$url_key_name]['id']);
            }
        }
        if(!empty(
    $tracker_url) && !empty($template_text) && !empty($matches[0][$i][0])){
            
    $template_text=substr_replace($template_text,$tracker_url,$matches[0][$i][1], strlen($matches[0][$i][0]));
            
    $template_text=str_replace($sugar_config['site_url'].'/'.$sugar_config['site_url'],$sugar_config['site_url'],$template_text);
        }

    especially


    PHP Code:
        if (!empty($tracked_urls[$url_key_name])) {
            if (
    $tracked_urls[$url_key_name]['is_optout']==1){
                
    $tracker_url $removeme_url_template;
            } else {
                
    $tracker_url sprintf($url_template,$tracked_urls[$url_key_name]['id']);
            }
        } 

    $tracked_urls[$url_key_name]

    This is basically stating, run through and find all occurences of {TRACKER_NAME} in the email template.

    and

    if ($tracked_urls[$url_key_name]['is_optout']==1){

    then replace {TRACKER_NAME} placeholder in the email template with this dynamic text $removeme_url_template

    $tracker_url = $removeme_url_template;




    However the logic in the index.php?module=CampaignTrackers&action=DetailVie w

    does something different

    file: modules/CampaignTrackers/CampaignTrackers.php
    function: fill_in_additional_detail_fields()

    in my version of the code line 191-196 the original code looks like this

    PHP Code:
            if ($this->is_optout == 1) {
                
    $this->message_url .= '/index.php?entryPoint=removeme&identifier={MESSAGE_ID}';
            } else {
                
    $this->message_url .= '/index.php?entryPoint=campaign_trackerv2&track=' $this->id;
            } 

    I have changed this to

    PHP Code:
            if ($this->is_optout == 1) {
                
    //$this->message_url .= '/index.php?entryPoint=removeme&identifier={MESSAGE_ID}'; // HACK: Kenneth Thorman Commented in to fix a possible bug in displaying the text needed in the email template
                
    $this->message_url '{' $this->tracker_name '}';   // HACK: Kenneth Thorman New code that seems to work for me
            
    } else {
                
    $this->message_url .= '/index.php?entryPoint=campaign_trackerv2&track=' $this->id;
            } 
    This works for me, but I do not know if this can lead to bugs else where in the system, however the MESSAGE_ID string looks a little fishy to me. I have searched all the other code in my version of Sugar and I cannot find any reference to this MESSAGE_ID string that makes sense in this context. Further more if you use the generated "URL for Campaign Message:" for an opt out link you will get something like this in the email

    HTML Code:
    <a href="http://SERVER/index.php?entryPoint=removeme&amp;identifier=http://SERVER/index.php?entryPoint=removeme&identifier=b7ca7a48-63e8-d06e-e9ab-4bd73a91b648">
    USE AT YOUR OWN RISC, AND TEST BEFORE PUTTING INTO PRODUCTION

    Regards
    Kenneth Thorman

  5. #5
    kenneth.thorman is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    191

    Default Re: Opt Out Link Problem

    This is a follow up on the previous posting.

    When you insert the {OPT_OUT_TRACKER_NAME} (placeholder) in the email template TinyMCE does not allow a relative URL (at least in my SugarCrm version 5.1.0b).

    This means if you are running your site at http://MYSITE.com/ and you want the opt out to be like

    <a href="{OPT_OUT_TRACKER_NAME}">Unsubscribe</a>

    this will not work. The URL will be changed by TinyMCE/SugarCrm to become <a href="http://MYSITE.com/{OPT_OUT_TRACKER_NAME}">UnSubscribe</a>

    which in turn will lead to the following link in the email that is sent

    <a href="http://MYSITE.com/http://MYSITE.com/index.php?entryPoint=removeme&identifier=786c8da5-d2e2-d820-08d0-4bd7f064d1b7">UnSubscribe</a>

    (please note the bolded text in the line above have the http://MYSITE.com 2 times).

    This is due to TinyMCE in the default SugarCrm version not allowing relative urls.

    This can be patched in the following file


    include\SugarTinyMCE.php

    (starting line 57 in my version of SugarCrm)

    PHP Code:
        var $defaultConfig = array(
            
    'height' => 300,
            
    'width'    => '100%',
            
    'theme'    => 'advanced',
            
    'theme_advanced_toolbar_align' => "left",
            
    'theme_advanced_toolbar_location'    => "top",
            
    'theme_advanced_buttons1'    => "",
            
    'theme_advanced_buttons2'    => "",
            
    'theme_advanced_buttons3'    => "",
            
    'strict_loading_mode'    => true,
            
    'mode'    => 'exact',
            
    'plugins' => 'advhr,insertdatetime,table,preview,paste,searchreplace,directionality',
            
    'elements'    => '',
            
    'extended_valid_elements' => 'style,hr[class|width|size|noshade]',
        ); 

    should be changed to

    PHP Code:
        var $defaultConfig = array(
            
    'height' => 300,
            
    'width'    => '100%',
            
    'theme'    => 'advanced',
            
    'theme_advanced_toolbar_align' => "left",
            
    'theme_advanced_toolbar_location'    => "top",
            
    'theme_advanced_buttons1'    => "",
            
    'theme_advanced_buttons2'    => "",
            
    'theme_advanced_buttons3'    => "",
            
    'strict_loading_mode'    => true,
            
    'mode'    => 'exact',
            
    //Hack: TinyMCE optout url placeholder prefix with siteurl bug
            
    'relative_urls' => true,
            
    //Hack: TinyMCE optout url placeholder prefix with siteurl bug
            
    'plugins' => 'advhr,insertdatetime,table,preview,paste,searchreplace,directionality',
            
    'elements'    => '',
            
    'extended_valid_elements' => 'style,hr[class|width|size|noshade]',
        ); 

    Regards
    Kenneth Thorman

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem using opt-out link.
    By Gagan in forum General Discussion
    Replies: 8
    Last Post: 2008-12-30, 02:18 PM
  2. Dashboard / My Pipeline link problem
    By anssi in forum Help
    Replies: 3
    Last Post: 2006-10-10, 08:45 AM
  3. Problem with link in email - Cases
    By aksando in forum Help
    Replies: 1
    Last Post: 2006-08-03, 10:59 AM
  4. Replies: 0
    Last Post: 2006-05-04, 01:27 AM
  5. Contacts Full_name problem, missing link
    By lmarzke in forum Help
    Replies: 0
    Last Post: 2005-07-01, 12:50 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •