Coder Social home page Coder Social logo

Comments (10)

MachineITSvcs avatar MachineITSvcs commented on June 7, 2024 1

They have been sent.

from wp-ispconfig3.

MachineITSvcs avatar MachineITSvcs commented on June 7, 2024

The UpdClient function is used in the example cancelled method, and can also be used for switching master templates, updating passwords, limits, etc. Maybe utilize it on a form (for logged in users) that either creates or updates the ISPConfig user account by the same name as the WordPress username, depending on whether or not the user already exists. I would recommend providing this function only when a username is gathered automatically to avoid an existing user from being updated by someone else. I assume you’re turning this into some kind of form builder? I’m unable to look at the code presently, but if that is correct, then I recommend only utilizing that function when the username field does not exist in the form. I will look at the branch later today.

from wp-ispconfig3.

ole1986 avatar ole1986 commented on June 7, 2024

To update (or manage) ISPconfig users based on their wordpress login I was more thinking of a small plugin, the developer can create for each action individually

Currently wp-blocks branch supports the following actions (but this may change):

  • ispconfig_block_action_create_client
  • ispconfig_block_action_create_website
  • ispconfig_block_action_create_website_new
  • ispconfig_block_action_update_client

Below would be a working example plugin

<?php
/*
Plugin Name: Ispconfig client2user
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: Always overwrite the ISPConfig client id to its logged in wp_user.
Version: 1.0
Author: ole1986
License: GPL2
*/

add_filter('ispconfig_block_action_update_client', function($fields) {

    $user = wp_get_current_user();

    array_walk($fields, function(&$item) use($user) {
        if($item['id'] == 'client_username') $item['value'] = $user->user_login;
    });

    return $fields;
});

This will overwrite the "action" known as "Update client" (may change in future) to always use the logged in account.

There will be other actions available of course (E.g. "Update bank details") which can easily be included through the add_filter callback.

And even more, it could overwrite the default values (being set by the gutenberg block) from different sources.

from wp-ispconfig3.

ole1986 avatar ole1986 commented on June 7, 2024

@MachineITSvcs I have updated the wp-blocks branch so, that I could actually get rid of the shortcodes (including the "canceled" one).

It would be really helpful you can test it and let me know what you think about it.
Please note that this is still not release and errors/problems may occur.

Thank you in advanced

from wp-ispconfig3.

MachineITSvcs avatar MachineITSvcs commented on June 7, 2024

After re-reading your previous message, I noticed you said you may change the Client Update function in the future to always use the logged in user. How I currently use this function is to detect on web hosting (subscription checkout) if the client already exists and update it if necessary. This also runs on every recurring payment, and the canceled method is used when a payment is failed or subscription canceled. So using the logged in user would not be a good idea, as the username needs to be able to get passed into the function on a backend recurring payment for example.

from wp-ispconfig3.

ole1986 avatar ole1986 commented on June 7, 2024

Well, the action/filter hook can actually be used to overwrite the username and other fields dependent on the action being used.

The only difficulty I see now from your last comment, is that you are using such Shortcodes to immediately call an ISPconfig soap action instead of waiting for a user input. Is this correct?!

Can you explain how you trigger the shortcode in recurring payments

from wp-ispconfig3.

MachineITSvcs avatar MachineITSvcs commented on June 7, 2024

That is correct. This is how I’ve always done it, but I also have another custom method besides canceled for this purpose. Would you like me to include both here as examples? They are fairly basic.

from wp-ispconfig3.

MachineITSvcs avatar MachineITSvcs commented on June 7, 2024

I would prefer to email you the code actually

from wp-ispconfig3.

ole1986 avatar ole1986 commented on June 7, 2024

I have improved the use of custom shortcode classes, allowing you to put the files outside of the wp-ispconfig3 plugin.

Check out this wiki page on how to upgrade and implement for version 1.4.0

from wp-ispconfig3.

ole1986 avatar ole1986 commented on June 7, 2024

@MachineITSvcs I am planning to release this version soon. Does the changes fit to your needs?

from wp-ispconfig3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.