Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/30/2018 in all areas

  1. Tyson

    Get username

    If you are unable to access the blesta_id from the session: $user_id = (isset($_SESSION['blesta_id']) ? $_SESSION['blesta_id'] : null); ...then I would suggest following @Blesta Addons's recommendation of creating a plugin. If you upgrade Blesta to v4.3.0+ then your plugin can make use of the new Requestor object that retrieves some relevant information on the currently-logged-in user. If the user is currently logged into Blesta, you should be able to retrieve their user information by creating a plugin with a model that fetches the user from the database, e.g.: class MyPluginUserModel extends MyPluginModel { public function getCurrentUser() { // Load information on the current user $requestor = $this->getFromContainer('requestor'); // Fetch additional information on the current user if ($requestor->user_id !== null) { Loader::loadModels($this, ['Users']); // Fetch and return the user if one exists if (($user = $this->Users->get($requestor->user_id))) { return $user; } } // Return null that no user was found return null; } } You just need to make an API call to your "MyPluginUserModel::getCurrentUser" to retrieve the user. If a non-null value is returned, the username would be available in the "username" property: <?php // Load the API require_once "/home/username/public_html/blesta_api.php"; $user = "API USERNAME"; $key = "API KEY"; $url = "https://blestainstallationurl.com/api/"; $api = new BlestaApi($url, $user, $key); // Fetch the current user's username if they are logged into Blesta $username = null; if (($user = $api->get("MyPlugin.MyPluginUserModel", "getCurrentUser"))) { $username = $user->username; }
    2 points
  2. the domains logic in blesta should only have some tweaks to be fully functional, rather than create a whole system for that, if blesta can tweak the pricing model system to add two new fields (Renew, Transfer) and use them in case of renew or transfer update the whole registrar module to have a unique function names like updating nameservers, updating whois contact, registering child name servers, ect ... if blesta can begin with this suggestion i think is totally accepted and can be improved by the time, WhmXX has this already with the same mechanism and they are doing well . Reinventing a new system will lead to a serious problem and test and improvement that will be infinite . I hope we can see something in the near future and before 2019 because personally if no update comming in this subject i would be forced to move to other competitor .
    1 point
×
×
  • Create New...