Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Using calendar shortcode, add styling? #335070
    James LeDoux
    Participant

    Yes, directly into an html field in the newsletter body.

    in reply to: Can't find excerpt length setting #324292
    James LeDoux
    Participant

    Okay, found it. You have to hover over the right upper corner of the newsletter body section (below the header) and click on the Ruler/Pencil icon (says "Edit" when you hover over it). Then the settings appear on the right.

    This is hard to find, so the documentation needs to be changed to make this easier to figure out, I searched "excerpts" and found nothing useful.

    James LeDoux
    Participant

    As shown in their documentation on the Newsletter REST API, user lists are designated with "lists", so, you'd add that to the array, like:

    
    $data = array("email" => $email, "api_key" => "your_key", "name" => $name, "lists" => $lists, "status" => "C");
        $data_string = json_encode($data);

    Again, you'd have to establish what your own variable names refer to, in this case, $name, $lists, etc. So, in your script, you'd have to tie $name to the person's name you're dealing with at the time, $lists to the lists they belong to, etc.

    At least, I believe this should work, I haven't tried it with lists.

    in reply to: "More" tag at end of excerpt is now repeating the title #101715
    James LeDoux
    Participant

    I am using a pretty old custom theme at this point. I made it from the default theme a couple years ago. Do I need to recreate it? Or can I copy something over from the current default theme to make it work correctly? Or how can I change the filter to make it work? Thanks.

    James LeDoux
    Participant

    This is SO awesome! Newsletter Plugin, you rock!

    Okay, should've just done my homework first before asking those last questions. The examples given in the documentation are command line arguments. I did some research, and for anyone else trying to figure this out, here's how to make it work in a PHP script. (Variables like $email have to be established first, of course):

        // Data in JSON format
        $data = array("email" => $email, "api_key" => "your_key", "name" => $name, "status" => "C");
        $data_string = json_encode($data);
        
        // Prepare new cURL resource
        $ch = curl_init('https://www.your_website.com/wp-json/newsletter/v1/subscribers/add');
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        
        // Set HTTP Header for POST request
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
            'Content-Length: ' . strlen($data_string))
            );
        
        $result = curl_exec($ch);
        
        // Close cURL session handle
        curl_close($ch);
        
        # Print response to check success.
        echo "<pre>" . $result. "</pre>";
    James LeDoux
    Participant

    Great, that looks like it should work, but could you help me understand how to use it exactly? What we have is another subscription program for our hard-copy magazine on a subdomain of the same website that this plugin is on. We want to give magazine subscribers the option of subscribing to the newsletter. So, if they opt in, how do we send the api call exactly?

    In the php, would we simply put this line in the code for an opted-in person, in an IF statement, for example?
    curl -X POST http://<your-site>/wp-json/newsletter/v1/subscribe -d '{"email":"test@example.com", "name":"My name", "gender":"f"}'

    Also, what's the difference between that and this method?
    curl -X POST -H "Content-Type: application/json" http://<your-site>/wp-json/newsletter/v1/subscribers/add -d '{"email":"test@example.com", "api_key":"..."}'

    It says the latter works directly with the database, but wouldn't they both add a subscriber to the db? and could we use the api key with the first one too? Is it more secure that way? In the second example, I suppose you could add the name and other info the same way you do in the first, correct?

    Thanks for your help!

    James LeDoux
    Participant

    Also, the error message says, "Your PHP execution time limit is 600 seconds and cannot be changed or is too lower (sic)..."

    So, it sounds like Newsletter is trying to change the setting itself, is that right? Or is there a way to exempt this plugin from the limit?

    in reply to: Profile form ought to have labeled fields #28039
    James LeDoux
    Participant

    Okay, never mind, this is actually a styling issue. Your CSS has the labels as white. Since most web pages are white, this really ought to be changed -- the text doesn't show.

Viewing 8 posts - 1 through 8 (of 8 total)