Jump to content

BlackNovaDesigns-Kyle

Member
  • Posts

    5
  • Joined

  • Last visited

Everything posted by BlackNovaDesigns-Kyle

  1. As this is Googles first answer for whmcs get clients. For wordpress we wrote the following to get ours working, allowing us to tie it into a shortcode as well: //WHMCS Get Clients Shortcode //Written by Kyle - www.blacknovadesigns.co.uk function bnd_whmcs_get_clients_shortcode() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://YOUR-DOMAIN-WHERE-WHMCS-IS/includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'GetClients', 'username' => 'API-TOKEN-ID', 'password' => 'API-TOKEN-PASSWORD, 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); $results = json_decode($response, true); curl_close($ch); echo "<h3>" .$results['totalresults']. "</h3>"; echo "<p>HAPPY CLIENTS</p>"; } add_shortcode( 'whmcsgetclients', 'bnd_whmcs_get_clients_shortcode' ); Hopefully this will help for anyone looking to do this them selves in the future.
  2. Never Mind i have now fixed this and got it all working.
  3. I currently have taken on the old WHMCS CMS Plus add-on and is no longer developed. However - I am now re-writing it to have some new features, but need struggling to add a Database Upload Image function (stores Image URL in database), just wanted to know if anyone had done an image upload function before, I've written image uploads before but never in WHMCS so getting a little confused. Anyone have any ideas? Here is my current code but not sure if to wrap the Image Upload bit in a function, but how to then reference it in the hook? //Image Upload for Featured Image // Set Target Path for file upload $target_path = '../images/'. date("Y") . '/' . date("m") .'/'; if (!file_exists($target_path)) { mkdir($target_path, 0777, true); } if (!file_exists($target_path . 'thumbnails/')) { mkdir($target_path . 'thumbnails/', 0777, true); } //Valid Extensions $validextensions = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png', 'image/png' => 'png' ); //File Names $simpleName = $_POST['settings']['fimage']; $filename = rand().$_POST['settings']['fimage']; if (in_array($file_extension, $validextensions) && is_writable($target_path)) { if (move_uploaded_file($_POST['settings']['fimage'], $target_path) ) { // If file moved to uploads folder. $message .= '<li class="succes">'.$simpleName.' uploaded successfully!.</li>'; } else { // If File Was Not Moved. $message .= '<li class="error">'.$simpleName.' Failed to Upload - please try again!.</li>'; }} else { // If File Size And File Type Was Incorrect. $message .= '<li class="error">***Invalid file Size or Type***</li>'; } add_hook('cms/admin/page/edit', 1, 'cms_edit_admin_page_html'); function cms_edit_admin_page_html($vars, $target_path, $filename){ ob_start(); $values = json_decode(json_encode(Capsule::table('mod_whmcs_cms_plus_content')->where('id', $_GET['id'])->first()), true); $type = json_decode(json_encode(Capsule::table('mod_whmcs_cms_plus_content_types')->where('type', $values['type'])->first()), true); if(!empty($_POST['postaction']) && $_POST['postaction'] == 'edit_content'){ $slug = cms_sanitize_string($_POST['settings']['slug']); $meta = array(); foreach($_POST['settings']['meta'] as $key => $value){ if($value['key'] != ''){ $meta[$value['key']] = $value['value']; } } update_query('mod_whmcs_cms_plus_content', array( 'parent' => cms_insert_int(trim($_POST['settings']['parent'])), 'title' => trim($_POST['settings']['title']), 'slug' => $slug, 'fimage' => $target_path.$filename, 'content' => trim($_POST['settings']['content']), 'head_content' => trim($_POST['settings']['head_content']), 'comments' => cms_insert_int($_POST['settings']['comments']), 'fb' => cms_insert_int($_POST['settings']['fb']), 'twitter' => cms_insert_int($_POST['settings']['twitter']), 'gplus' => cms_insert_int($_POST['settings']['gplus']), 'published' => cms_insert_int($_POST['settings']['published']), 'updated' => date("Y-m-d H:i:s"), 'ssl' => cms_insert_int($_POST['settings']['ssl']), 'private' => cms_insert_int($_POST['settings']['private']), 'restrictions' => serialize($_POST['settings']['restrictions']), 'breadcrumbs' => cms_insert_int($_POST['settings']['breadcrumbs']), 'meta' => serialize($meta) ), array( 'id' => $_GET['id'] )); $type = json_decode(json_encode(Capsule::table('mod_whmcs_cms_plus_content_types')->where('type', $values['type'])->first()), true); run_hook('cms/content/edit', array_merge($vars, array('id' => $_GET['id'], 'type' => $type))); $values = json_decode(json_encode(Capsule::table('mod_whmcs_cms_plus_content')->where('id', $_GET['id'])->first()), true); echo '<div class="successbox"><strong><span class="title">'.$vars['_lang']['content_updated'].'</span></strong></div>'; } echo cms_display_form(cms_content_fields($vars, $type, $values['id']), $values, $vars['modulelink'].'&tab=edit&id='.$_GET['id'].'', $vars, array('postaction' => 'edit_content')); return ob_get_clean(); } Thanks Kyle
  4. I have just done a test using print $_REQUEST['m']; When using the old Index.php it shows the whmcs_cms_plus but when using the new index.php it is not - so i then tried outputting hello print $_REQUEST['m']; print 'hello'; And the hello didn't appear either but on the old index.php it did.
  5. Hello Guys, A module I'm using has gone dead with support for nearly a year now, so looks like the author has gone. The basic issue I get is that if using a WHMCS 7.1.2 index.php the module works perfectly if I use WHMCS 7.2/7.4.1 index.php it fails to work. What I seem to see that's not working is that the variable "m=??" is not working. I know WHMCS 7.3 started to use new SEO URLS for like the Sign-in integrations which doesn't work, either, so my question really is what has changed to how the index.php has changed between the versions? The module is looking for a "m=whmcs_cms_plus" but doesn't seem to be passed, because as soon as you put in the website URL with the appending parameter in the URL it works e.g. http://www.yourdomain.com/testpage?m=whmcs_cms_plus - the page will load correctly if i was to load the following http://www.yourdomain.com/testpage - the page would just 404 error. I tried just putting a quick fix something like <input type="hidden" name="m" value="whmcs_cms_plus" /> but doesn't seem to fix the issue. The module loads the SEO URLs by doing the following: <?php $_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI']; $_SERVER['SCRIPT_NAME'] = $_SERVER['REQUEST_URI']; $_REQUEST['m'] = 'whmcs_cms_plus'; require(dirname(dirname(dirname(dirname(__FILE__)))).'/index.php'); print $_REQUEST['m']; Thanks, Kyle
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated