Forum Replies Created

Viewing 15 replies - 16 through 30 (of 74 total)
  • Thread Starter ajaxStardust

    (@ajaxstardust)

    @jeffparker

    I installed and activated YARPP on this site. There are no thumbnails showing at this time.

    If I recall correctly, Yarpp takes some time to propagate. That is, the thumbs don’t show up immediately.

    It’ll be there for now, and the other plugin deactivated.
    Cheers!

    Thread Starter ajaxStardust

    (@ajaxstardust)

    Sure @jeffparker !

    Hit me up in a day or two and i’ll have a report for you. my WPorg username at gmail.

    See? You make me smile. I think we communicated MANY years ago, way back when. I had the coolest plugin ’cause no one else had thumbnails!

    One of my servers are down right now for bandwidth use after fixing a plugin. I’m not going to slam the plugin like others have. I should have read more about how my plugin configuration actions would affect the site. I’d like to have had a warning that all URL’s sitewide would be changed. It was probably in the fine print. Perhaps that sort of thing should place a plugin in a warning state. I can’t say your plugin ever resulted in a need to basically start over.
    ??

    Alas, with great power comes great responsibility.

    Thread Starter ajaxStardust

    (@ajaxstardust)

    Thanks. You’re the man. The Coffee-cup-man!
    ??

    Meanwhile, I went with …. i think it’s called Related Posts Thumbnails. I always liked your plugin of course. It provides more customization options.

    It’s great news to know it can be used again, safely and without warnings!

    Cheers and best regards.

    “Bug Report”
    @vmarko Are you suggesting that the user’s experience is due to a bug, or are you simply advising it’s only “free” to submit a bug report?

    Thread Starter ajaxStardust

    (@ajaxstardust)

    sorry. not my problem. i couldn’t care less.

    Thread Starter ajaxStardust

    (@ajaxstardust)

    Thread Starter ajaxStardust

    (@ajaxstardust)

    haha. i dunno @bcworkz .
    it’s been submitted for review as a plugin. so, we’ll see what happens.

    @anonmeimei using my example here (which is basically the same question as yours, above). While I received nothing useful in reply, you might take what I did (e.g. guessing at the font-weights / corresponding names), and use the following reference.

    • Thin: 100
    • Extra Light: 200
    • Light: 300
    • Regular: 400
    • Medium: 500
    • Semi Bold: 600
    • Bold: 700
    • Extra Bold: 800
    • Black: 900

    Stab at it with trial and error. Sadly, for a community based around software transitioning to a new framework, it seems no one cares to assist further. But why not get on board anyway!

    Personally I don’t have a reason to care about my experimentation down that path. I never did much more with it. Wish I had the definitive answer for you. I’ll play with it again some day. Play with it. Ask questions. Get bored and disappointed. It’s kind of sad, really.

    If nothing else, you might try participating in their Slack group. Good luck.

    • This reply was modified 1 year, 9 months ago by ajaxStardust.
    • This reply was modified 1 year, 9 months ago by ajaxStardust. Reason: embellishment

    Check out this tutorial:
    https://fullsiteediting.com/lessons/theme-json-typography-font-styles/#h-font-weight

    I wrote something about theme.json as well but i don’t recommend following my advice.

    Thread Starter ajaxStardust

    (@ajaxstardust)

    i found my issue with the HTML cutting off after <div class="contextual-help-tabs-wrap"> : see line 903 of WP_Screen (2023.06.05)

    My content is now displaying as it did when the page was standalone. But that’s just it. It’s still not rendering as part of the tabbed view.

    I suspect it’s a WP_Screen issue, but i’m not sure where to begin debugging for that.

    Thread Starter ajaxStardust

    (@ajaxstardust)

    The following is the solution to prevent the wp_usermeta.meta_value from becoming an infinitely long multi-dimensional array; to handle the issue issue i encountered with the serialized data. Note the dynamic value in the foreach() loop:

    <?php
        $user_membership = get_user_meta($user_id, 'zto_membergroup');
        $zto_helpers = new Zto_Helpers();
        $user_membership = wp_parse_args($user_membership, $zto_helpers->zto_membergroup_defaults());
        if(is_array($user_membership) && !empty($user_membership[0])){
            $default_membership = $user_membership;
            // echo '<br>var_dump(default_membership): '.var_dump($default_membership);
            $user_membership = $default_membership[0];
            $user_membership = array_merge($user_membership, $default_membership);
        }
        else {
            $user_membership = wp_parse_args($user_membership, $zto_helpers->zto_membergroup_defaults());
        }
        $membergroup = get_option('zto_membergroup');
        $zto_helpers = new Zto_Helpers();
        if ($membergroup) {
            $membergroup = wp_parse_args($membergroup, $zto_helpers->zto_membergroup_defaults());
        } else {
            $membergroup = $zto_helpers->zto_membergroup_defaults();
        }
        
        
        $array0 = $user_membership;
        if(!empty($array0[0])) {
        $array1 = array_slice($array0, 0, count($array0) - 1, true); 
    $userInputArray = array('one', 'two', 'three', 'four', 'five');
    
    // Initialize the filter key array
    $filterKeys = array();
    
    // Loop through the user input values
    foreach ($userInputArray as $uiKey => $uiVal) {
        // Add the filter key if it matches the key in the nested array
        if (isset($array0[0]["zto_membergroup_$uiVal"]) && $array0[0]["zto_membergroup_$uiVal"] === '1') {
            $filterKeys[] = "zto_membergroup_$uiVal";
        }  
    }
    
    // Get the filtered array with the dynamic keys
    $array2 = array_filter($array0[0], function($key) use ($filterKeys) {
        return in_array($key, $filterKeys);
    }, ARRAY_FILTER_USE_KEY);
     
        // Merge the two arrays
        $user_membership = array_merge($array1, $array2);
    }
     
    ?>
    • This reply was modified 1 year, 10 months ago by ajaxStardust.
    Thread Starter ajaxStardust

    (@ajaxstardust)

    I think I’m on the right track, but still stuck. I discovered that when “the form” (the Settings API registered fields) work as desired, the following is what’s put in wp_usermeta. The first line shows results of a user joining one member group. the second is accompanied by a screenshot:

    # member of one group:
    a:1:{s:20:"zto_membergroup_four";s:1:"1";}
    
    # member of three groups:
    a:3:{s:19:"zto_membergroup_two";s:1:"1";s:21:"zto_membergroup_three";s:1:"1";s:20:"zto_membergroup_four";s:1:"1";}
    The form selections resulting in the a:3 (#member of 3 groups) as described above

    When the data isn’t processed as I want, the following is what I’m getting (first row, then second after second submission, and so on adding more multi-dimensional arrays):

    Note that the sub-array is present but empty the first submission resulting in a:6 instead of a:5, then a:6 is filled on second submit:

    #FIRST _REQUEST
    a:6:{s:19:"zto_membergroup_one";s:0:"";s:19:"zto_membergroup_two";s:0:"";s:21:"zto_membergroup_three";
    s:0:"";s:20:"zto_membergroup_four";s:0:"";s:20:"zto_membergroup_five";s:0:"";i:0;N;}
    
    #SECOND _REQUEST
    a:6:{s:19:"zto_membergroup_one";s:0:"";s:19:"zto_membergroup_two";s:0:"";s:21:"zto_membergroup_three";s:0:"";
    s:20:"zto_membergroup_four";s:0:"";s:20:"zto_membergroup_five";s:0:"";i:0;a:6:{s:19:"zto_membergroup_one";s:0:"";s:19:"zto_membergroup_two";s:0:"";s:21:"zto_membergroup_three";s:0:"";s:20:
    "zto_membergroup_four";s:0:"";s:20:"zto_membergroup_five";s:0:"";i:0;s:0:"";}}

    What I am expecting is a sort of combination of the two, as in the data in the db would be an array of length 5 (not multi-dimensional), like so:

    a:5:{s:19:"zto_membergroup_one";s:0:"";s:19:"zto_membergroup_two";s:0:"";s:21:"zto_membergroup_three";s:0:"";
    s:20:"zto_membergroup_four";s:1:"1";s:20:"zto_membergroup_five";s:0:"";}

    I haven’t solved anything of course. Merely wanted to show what I’m getting. I guess the first sample (with the single key/ value pair serialized) is my goal since that’s what works. I’m not looking for an answer to give me the store the array w/ 5 members, regardless of their value. The point is to allow users to define his/ her membership in 1 or more of 5 member groups.

    RE: THE _POST / _GET Requests described in the o/p:
    As far as I can tell, these fields will never process using my conditional logic– as it is, as shown above– looking for a _POST value, because _POST is empty by the time the code gets to the update function, but I could be wrong. Despite the username, sadly I am not a master of Ajax.

    Also, while debugging, I see that the _POST values are placed in a cache array, so they aren’t just disregarded. I guess it’s progress to understand that. Though that’s a mere observation (i wouldn’t say “i understand it” yet). I regret I didn’t note the name/ settings page / line where the _POST values are stored elsewhere (maybe wp-settings): I assume that’s the WP way of handling this type of Request, but I’m not familiar enough to just get it yet.

    Thank you!

    EDIT: One last thing. I realize I could have achieved this in probably under 30 minutes using a plugin like Advanced Custom Fields (which I did, in fact), but I don’t want that. I don’t like the way ACT adds the meta key/ value pairs. I’m sure there’s a way to get it to enter then as serialized, but I don’t care. That’s not interesting or useful to me at all to use a plugin to achieve what the CMS was developed to be able to do for a person who knows PHP (even a little bit of PHP), it seems more than lazy and … i can’t think of the word I’d want to use. Just lame. haha. I don’t mean to insult anyone by saying that. I was the same way w/ guitar. That’s why I was a good musician. Investing the time to learn to do something correctly tends to return a better value.

    • This reply was modified 1 year, 10 months ago by ajaxStardust. Reason: code and illustration
    • This reply was modified 1 year, 10 months ago by ajaxStardust. Reason: alignment
    • This reply was modified 1 year, 10 months ago by ajaxStardust.
    • This reply was modified 1 year, 10 months ago by ajaxStardust.
    • This reply was modified 1 year, 10 months ago by ajaxStardust. Reason: addendum
    Thread Starter ajaxStardust

    (@ajaxstardust)

    I changed the first part of the update_user_meta() function to check for the correct http request. what i have above reflects the values (erroneously) of the _GET req i’d mentioned. oddly, I don’t notice any remarkable changes in the way it’s functioning:

        public function zto_membergroup_members()
        {
            $zto_helpers = new Zto_Helpers();
            if ($_POST['action'] == 'updated') {
    • This reply was modified 1 year, 10 months ago by ajaxStardust.
    Thread Starter ajaxStardust

    (@ajaxstardust)

    I think it’s easily fixed by simply removing the boolean from the arguments.

    Thread Starter ajaxStardust

    (@ajaxstardust)

    For clarity:

    https://github.com/szepeviktor/phpstan-wordpress doesn’t help to “run” PHPStan, as suggested above. It installs a set of rules for PHPStan, or instructions, to help PHPStan understand that the code base is the WordPress CMS so reporting is most relevant. (e.g. not to be confused with a WordPress plugin).

    Visual Studio Code users should see the Marketplace for a VS Code extension to enhance use of PHPStan as well.

Viewing 15 replies - 16 through 30 (of 74 total)