Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter aleykey

    (@aleykey)

    Hey @bcworkz I managed to get the values out of the form!
    This is what the console responds
    Parameterapplication/x-www-form-urlencodedNicht sortieren
    campaign
    0
    email
    [email protected]
    hash
    ownreason
    qwgzdru
    reason
    otherreason
    Quelle
    hash=&campaign=0&reason=otherreason&ownreason=qwgzdru&email=testmail%40live.de

    Now how can I put the values which are shown in the console after submitting the form, in a wordpress Admin menu page? or a table?

    Thank you very much.

    Best regards

    Thread Starter aleykey

    (@aleykey)

    But I´am not quite sure I found it in the action.class.php

    <?php if(!defined(‘ABSPATH’)) die(‘not allowed’);

    class mymail_actions {

    // 1 2 3 4 5 6 7
    private $types = array(”, ‘sent’, ‘open’, ‘click’, ‘unsubscribe’, ‘bounce’, ‘hardbounce’, ‘error’);

    public function __construct() {

    add_action(‘plugins_loaded’, array( &$this, ‘init’ ), 1 );

    }

    public function init() {

    add_action(‘mymail_send’, array( &$this, ‘send’), 10 , 2);
    add_action(‘mymail_open’, array( &$this, ‘open’), 10 , 3);
    add_action(‘mymail_click’, array( &$this, ‘click’), 10 , 4);
    add_action(‘mymail_unsubscribe’, array( &$this, ‘unsubscribe’), 10 , 2);
    add_action(‘mymail_bounce’, array( &$this, ‘bounce’), 10 , 3);
    add_action(‘mymail_subscriber_error’, array( &$this, ‘error’), 10 , 3);

    add_action(‘mymail_cron’, array( &$this, ‘cleanup’));

    }

    public function get_fields($fields = NULL, $where = NULL) {

    global $wpdb;

    $fields = esc_sql(is_null($fields) ? ‘*’ : (is_array($fields) ? implode(‘, ‘, $fields) : $fields));

    $sql = “SELECT $fields FROM {$wpdb->prefix}mymail_actions WHERE 1=1”;
    if(is_array($where)){
    foreach($where as $key => $value){
    $sql .= “, “.esc_sql($key).” = ‘”.esc_sql($value).”‘”;
    }
    }

    return $wpdb->get_results($sql);

    }

    public function send($subscriber_id, $campaign_id) {

    return $this->add_action(array(
    ‘subscriber_id’ => $subscriber_id,
    ‘campaign_id’ => $campaign_id,
    ‘type’ => 1,
    ), true);

    }

    public function open($subscriber_id, $campaign_id, $explicit = true) {

    return $this->add_subscriber_action(array(
    ‘subscriber_id’ => $subscriber_id,
    ‘campaign_id’ => $campaign_id,
    ‘type’ => 2,
    ), $explicit);

    }

    public function click($subscriber_id, $campaign_id, $link, $index = 0, $explicit = true) {

    $this->open($subscriber_id, $campaign_id, false);

    $link_id = $this->get_link_id($link, $index);

    return $this->add_subscriber_action(array(
    ‘subscriber_id’ => $subscriber_id,
    ‘campaign_id’ => $campaign_id,
    ‘type’ => 3,
    ‘link_id’ => $link_id,
    ), $explicit);

    }

    public function unsubscribe($subscriber_id, $campaign_id) {

    return $this->add_action(array(
    ‘subscriber_id’ => $subscriber_id,
    ‘campaign_id’ => $campaign_id,
    ‘type’ => 4,
    ));

    }

    Thread Starter aleykey

    (@aleykey)

    I found it

    add_action(‘mymail_unsubscribe’, array( &$this, ‘unsubscribe’), 10 , 2);

    Know how do I get the values out of it and add it to the WP Admin Panel as a Menu or Tab , for each unsubscribed user Like a table or something else

    Thread Starter aleykey

    (@aleykey)

    Hey thank you very much. That helped me very much .But I can´t find wp_ajax_{ajax_action}…. for something with unsubscribe. The PlugIn has many Directories with many Files for example in classes directory there are ajax.class.php and actions.class.php etc. but I can´t figure it out so I can´t find the actions name to call it.

    I´m Stuck with this.

    Best Regards

    Thread Starter aleykey

    (@aleykey)

    Thank you very much this was helpful,

    but the Plugin is a little bit difficult to customize I think I found this in the same code file, it´s submitted via ajax but can´t help it out.

    public function unsubscribe( ) {

    $return[‘success’] = false;

    $_BASE = $_POST;

    if(empty($_BASE)){
    wp_die(‘no data’);
    };

    $campaign_id = !empty($_BASE[‘campaign’]) ? intval($_BASE[‘campaign’]) : NULL;

    if(isset($_BASE[’email’])){
    $return[‘success’] = mymail(‘subscribers’)->unsubscribe_by_mail($_BASE[’email’], $campaign_id);
    }else if(isset($_BASE[‘hash’])){
    $return[‘success’] = mymail(‘subscribers’)->unsubscribe_by_hash($_BASE[‘hash’], $campaign_id);
    }else{
    //wp_redirect(mymail()->get_unsubscribe_link());
    //exit;
    }

    //redirect if no ajax request
    if (isset($_SERVER[‘HTTP_X_REQUESTED_WITH’])) {

    $return[‘html’] = $return[‘success’]
    ? mymail_text(‘unsubscribe’)
    : (empty($_POST[’email’])
    ? mymail_text(‘enter_email’)
    : mymail_text(‘unsubscribeerror’));

    @header( ‘Content-type: application/json’ );
    echo json_encode($return);
    exit;

    }else{

    if($return[‘success’]){
    wp_die($return[‘html’].’‘.mymail_text(‘unsubscribe’).’‘);
    }else{
    wp_die($return[‘html’].’‘.(empty($_POST[’email’]) ? mymail_text(‘enter_email’) : mymail_text(‘unsubscribeerror’)).’‘);
    }
    exit;

    }

    }

    public function strip_css($css) {
    $css = strip_tags($css);
    $css = preg_replace(‘!/\*[^*]*\*+([^/][^*]*\*+)*/!’, ”, $css);
    $css = trim(str_replace(array(“\r\n”, “\r”, “\n”, “\t”, ‘ ‘, ‘ ‘), ”, $css));
    $css = str_replace(‘ {‘, ‘{‘, $css);
    $css = str_replace(‘{ ‘, ‘{‘, $css);
    $css = str_replace(‘ }’, ‘}’, $css);
    $css = str_replace(‘}’, ‘}’.”\n”, $css);
    return $css;
    }

    private function get_form_action($action = ”) {

    $is_permalink = mymail(‘helper’)->using_permalinks();

    $prefix = !mymail_option(‘got_url_rewrite’) ? ‘/index.php’ : ‘/’;

    return $is_permalink
    ? home_url($prefix.’/mymail/’.$this->form_endpoint)
    : add_query_arg(array(‘action’ => $action), admin_url(‘admin-ajax.php’, $this->scheme));

    }

    Thread Starter aleykey

    (@aleykey)

Viewing 6 replies - 1 through 6 (of 6 total)