• Resolved Jing

    (@gujingc)


    Hi,

    We are implementing a solution and would like to know if it is possible to do the following:

    1) Allow different levels of authorization for different user roles. In particular, we would like to allow site admins to send newsletters. Allow Editors to compose newsletters, but the newsletters must be reviewed and approved by the admins before sending out.

    2) on the sign up form, allow users to choose different user types, like students and teachers. Once they choose that, the system will place them automatically in different lists.

    3) in a multisite installation, if an existing user who joined the network from subsite A, subscribes to newsletter from subsite B, he is automatically added to subsite B as a subscriber user.

    We understand the Newsletter Plugin is not designed for multisite yet. However, can this function be custom built by our team using your API? If so, how would you suggest them go about it.

    We have a very tight timeline. Any advice you can provide is greatly appreciated.

    • This topic was modified 5 years, 1 month ago by Jing.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Stefano Lissa

    (@satollo)

    Hi, to code extended behaviors you can use the TNP api (see https://www.thenewsletterplugin.com developer documentation section).

    We have not a workflow implemented like the one you need (admin, editors and so on).

    About the signup form, probably once again you need to intercept the registration, get back the subscription and change the lists using some custom fields.

    Stefano.

    Thread Starter Jing

    (@gujingc)

    Stefano,

    This is what your documentation says:

    You have to send an array of numbers with the list ids to be assigned to the subscriber. Pre-assigned lists will be added as well.

    $ curl -X POST -H “Content-Type: application/json” https://<your-site>/wp-json/newsletter/v1/subscribe
    -d ‘{“email”:”[email protected]”, “name”:”My name”, “gender”:”f”, “lists”: [1,2,12]}’

    So we can achieve the list assignment by doing the following:
    1) make the user type required
    2) based on user choice, assign a list number.

    Correct?

    Jing

    Plugin Author Stefano Lissa

    (@satollo)

    Yes, should work, of course install the API addon. You can even use the “add” endpoint to just register an entry into the database. The “subscribe” runs the whole subscription process (with mailing and so on).

    Stefano.

    Thread Starter Jing

    (@gujingc)

    We added this code to call the API:

    $array = array(1,2,13);
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => site_url()."/wp-json/newsletter/v1/subscribe",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "email=".$_POST['tiny_email']."&name=".$_POST['tiny_dispaly_name']."&lists=".$array."",
    CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "content-type: application/x-www-form-urlencoded"
    ),
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);

    We want to add the subscriber to the list. But now it is adding subscribers but not to the targeted list. Can you tell us what we did wrong?

    Thanks a million.

    Jing

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Questions regarding sign up form and user permission’ is closed to new replies.