• The codebase is an abomination!!!

    I’ve spent 6 hours just trying to find a hook for successful user registration and no luck. Obviously you’ve never heard of clean code? It seems quite clear that you guys never even thought about the design and logic behind what it was you where trying to create.

    As an example, can you try and explain the logic behind this?

    c_ws_plugin__s2member_pro_stripe_utilities::create_customer_charge($stripe_customer->id, $cost_calculations['total'], $cost_calculations['cur'], $cost_calculations['desc'], array(), $post_vars, $cost_calculations)

    Here’s a golden one:

    foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
    do_action('ws_plugin__s2member_before_custom_registration_field_errors_4bp', get_defined_vars());
    unset($__refs, $__v); // Housekeeping.

    The above code examples are just some of the nonsensical code I have seen throughout your codebase.

    So, can someone please explain to me how I can hook into a successful user registration action? If you plan to reference me to the notifications, don’t. It’s not reliable.

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author JasWSInc

    (@jaswsinc)

    @belphe9or writes about logic…

    ::create_customer_charge() seems pretty self-explanatory to me 🙂

    golden one

    Just because it’s something you don’t understand, doesn’t mean it’s poorly written. The foreach() iteration you see there allows for hooks to alter variables ‘by reference’, which greatly increases the flexibility of the plugin throughout.

    how I can hook into a successful user registration

    Have you considered user_register in WordPress core?
    https://codex.ww.wp.xz.cn/Plugin_API/Action_Reference/user_register

    s2Member attaches to this also in several ways, and it also triggers this core hook whenever a registration occurs in other areas of the codebase. So sticking to core in that endeavor may serve you well.

    Thread Starter belphe9or

    (@belphe9or)

    Ok i’ll make this clear.
    ::create_customer_charge($stripe_customer->id, $cost_calculations[‘total’], $cost_calculations[‘cur’], $cost_calculations[‘desc’], array(), $post_vars, $cost_calculations) could have been written as ::create_customer_charge($stripe_customer->id, array(), $post_vars, $cost_calculations) or am i missing anything?

    Just because it’s something you don’t understand, doesn’t mean it’s poorly written

    In the foreach loop you are creating an array of defined vars reference, then

    do_action('ws_plugin__s2member_before_custom_registration_field_errors_4bp', get_defined_vars());
    unset($__refs, $__v);

    then in the action you are using the defined vars directly (not the references array) and then you are unseting the array.
    So how is this increasing the flexibility of the plugin ? 🙂

    Plugin Author JasWSInc

    (@jaswsinc)

    $__refs is one of the defined vars, and it holds (temporarily) variables by reference from the current scope. This means that a hook, if necessary, can choose to alter the variables from the scope of the original ‘by reference’, by altering values in the $__refs container.

    Plugin Contributor Raam Dev

    (@raamdev)

    The codebase is an abomination!!!

    The codebase is one of the reasons s2Member has 40,000+ active installs and over 1 million downloads. It’s designed by developers for developers. Could it use some improvement? Certainly. But is it an abomination? Hardly.

    If you’d like to contribute to improving the codebase, please submit a Pull Request:
    https://github.com/websharks/s2member/

    I totally disagree with the reviewer. The coding is not the best thing I’ve seen,however saying this is the worst code means you haven’t seen what I saw.

    The plugin isn’t perfect, there is no a perfect plugin for communities. But.. this one is within the top 10 list.

    I am not associated with the author i just like to thank and being kind with something that’s free.

    Just my thought

    Good life guys

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

The topic ‘Worst Codebase i have ever seen!!!!!!’ is closed to new replies.