rob2 Posted February 18, 2016 Share Posted February 18, 2016 Hi, user registering,new ordering,or client area data(editing) page, i do not hope to show all the fields,just some fields, is any way to make the setting or modify ? thank you 0 Quote Link to comment Share on other sites More sharing options...
zomex Posted February 18, 2016 Share Posted February 18, 2016 Hello, Yes you should be able to make some fields optional under setup > general settings > other > Optional Client Profile Fields You could then remove these fields from the form in the following: /templates/your_template/clientregister.tpl templates/orderforms/your_cart_template/viewcart.tpl 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted February 19, 2016 Author Share Posted February 19, 2016 ok,i will try it. but it seems i can not modify the part as my attachment shows ? thank you. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 19, 2016 Share Posted February 19, 2016 but it seems i can not modify the part as my attachment shows ? you'll need an action hook to edit that - they've been a few posted in the forums. what exactly do you want to do with it - edit it in some way or remove it entirely? 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted February 19, 2016 Author Share Posted February 19, 2016 i want to remove some fileds avoid to show and also modify their ordering. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 19, 2016 Share Posted February 19, 2016 you can use the link below that i've given you before - it will work, but it's not perfect. http://forum.whmcs.com/showthread.php?105295-Address-format-in-V6-02-Template-SIX&p=433838#post433838 i've modified it slightly for you - it will work and allow you to modify the order of the address elements to your own needs... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $client = Menu::context('client'); if($client->companyname != ""){ $name = '<strong>'.$client->companyname.'</strong>'; } else { $name = '<strong>'.$client->fullname.'</strong>'; } $address1 = $client->address1; if($client->address2 != ""){$address2 = '<br>'.$client->address2;}else{$address2="";} $city = ' '.$client->city; $state = '<br>'.$client->state; $postcode = '<br>'.$client->postcode; $country = '<br>'.$client->countryname; $address_new = $name."<p>".$address1.$address2.$postcode.$city.$state.$country."</p>"; if (!is_null($primarySidebar->getChild('Client Details'))) { $primarySidebar->removeChild('Client Details') ->addChild('Client Details') ->moveToFront() ->addChild($address_new); } }); it's still not the best way to do it - removing and adding a sidebar child! yuk!! btw - the only reason i'm not describing the 'correct' way of how to do this, is because it's central to a project i'm working on... all will be revealed in the future! 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted March 4, 2016 Author Share Posted March 4, 2016 does it mea you will releae a plugin to edit it ? 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted March 4, 2016 Author Share Posted March 4, 2016 you can use the link below that i've given you before - it will work, but it's not perfect. http://forum.whmcs.com/showthread.php?105295-Address-format-in-V6-02-Template-SIX&p=433838#post433838 i've modified it slightly for you - it will work and allow you to modify the order of the address elements to your own needs... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $client = Menu::context('client'); if($client->companyname != ""){ $name = '<strong>'.$client->companyname.'</strong>'; } else { $name = '<strong>'.$client->fullname.'</strong>'; } $address1 = $client->address1; if($client->address2 != ""){$address2 = '<br>'.$client->address2;}else{$address2="";} $city = ' '.$client->city; $state = '<br>'.$client->state; $postcode = '<br>'.$client->postcode; $country = '<br>'.$client->countryname; $address_new = $name."<p>".$address1.$address2.$postcode.$city.$state.$country."</p>"; if (!is_null($primarySidebar->getChild('Client Details'))) { $primarySidebar->removeChild('Client Details') ->addChild('Client Details') ->moveToFront() ->addChild($address_new); } }); it's still not the best way to do it - removing and adding a sidebar child! yuk!! btw - the only reason i'm not describing the 'correct' way of how to do this, is because it's central to a project i'm working on... all will be revealed in the future! may i ask if you lose " ?> " at end ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 4, 2016 Share Posted March 4, 2016 does it mean you will releae a plugin to edit it ? in a way, yes - but that wouldn't be its core function... anyway, editing it easy as you can just modify the hook code, i'm working on taking it to another level! may i ask if you lose " ?> " at end ? you don't need them with hooks... http://forum.whmcs.com/showthread.php?110991-moving-cron-directory-config-php-question&p=452467#post452467 We don't require the ?> file to user-modifiable files if possible. This is because it can often lead to problems if code, carriage returns or blank spaces are added afterwards. 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted March 31, 2016 Author Share Posted March 31, 2016 Hi, the hook will remove the edit button,many i ask how can i keep the button here ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 31, 2016 Share Posted March 31, 2016 the hook will remove the edit button,many i ask how can i keep the button here ? that's why I don't like the method he used, he's removing the sidebar and then re-creating it again. what you'll need to do is add a footer to your new sidebar... $footer = '<a href="clientarea.php?action=details" class="btn btn-success btn-sm btn-block"><i class="fa fa-pencil"></i> '.Lang::trans('clientareaupdatebutton').'</a>'; ->setFooterHtml($footer); add the $footer variable after the $client variable line; and add the setFooter code after the addChild($address_new); line - remove the ; from that line, so that you only have one after this new setFooter line... that should work. 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted March 31, 2016 Author Share Posted March 31, 2016 Hi, do you mind help me correcting the following ? <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $client = Menu::context('client'); $footer = '<a href="clientarea.php?action=details" class="btn btn-success btn-sm btn-block"><i class="fa fa-pencil"></i> '.Lang::trans('clientareaupdatebutton').'</a>'; ->setFooterHtml($footer); if($client->companyname != ""){ $name = '<strong>'.$client->companyname.'</strong>'; } else { $name = '<strong>'.$client->fullname.'</strong>'; } $address1 = $client->address1; if($client->address2 != ""){$address2 = '<br>'.$client->address2;}else{$address2="";} $city = ' '.$client->city; $state = '<br>'.$client->state; $postcode = '<br>'.$client->postcode; $country = '<br>'.$client->countryname; $address_new = $name."<p>".$address1.$address2.$postcode.$city.$state.$country."</p>"; if (!is_null($primarySidebar->getChild('Client Details'))) { $primarySidebar->removeChild('Client Details') ->addChild('Client Details') ->moveToFront() ->addChild($address_new) ->setFooter($footer); } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 31, 2016 Share Posted March 31, 2016 get rid of that first ->setFooterHtml($footer); before the if statement and it should work then. 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted March 31, 2016 Author Share Posted March 31, 2016 Hi, i modify it as following but still get 500 error,may you help me check again ? <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $client = Menu::context('client'); $footer = '<a href="clientarea.php?action=details" class="btn btn-success btn-sm btn-block"><i class="fa fa-pencil"></i> '.Lang::trans('clientareaupdatebutton').'</a>'; if($client->companyname != ""){ $name = '<strong>'.$client->companyname.'</strong>'; } else { $name = '<strong>'.$client->fullname.'</strong>'; } $address1 = $client->address1; if($client->address2 != ""){$address2 = '<br>'.$client->address2;}else{$address2="";} $city = ' '.$client->city; $state = '<br>'.$client->state; $postcode = '<br>'.$client->postcode; $country = '<br>'.$client->countryname; $address_new = $name."<p>".$address1.$address2.$postcode.$city.$state.$country."</p>"; if (!is_null($primarySidebar->getChild('Client Details'))) { $primarySidebar->removeChild('Client Details') ->addChild('Client Details') ->moveToFront() ->addChild($address_new) ->setFooter($footer); } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 31, 2016 Share Posted March 31, 2016 aagghhh... deleting and adding the same child... I can't look at that code anymore! let's do it properly and you won't even have to mess with the footer... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) { $client = Menu::context('client'); if($client->companyname != ""){ $name = '<strong>'.$client->companyname.'</strong>'; } else { $name = '<strong>'.$client->fullname.'</strong>'; } $address1 = $client->address1; if($client->address2 != ""){ $address2 = '<br>'.$client->address2; } else { $address2=''; } $city = ' '.$client->city; $state = '<br>'.$client->state; $postcode = '<br>'.$client->postcode; $country = '<br>'.$client->countryname; $address_new = $name.'<p>'.$address1.$address2.$postcode.$city.$state.$country.'</p>'; if (!is_null($primarySidebar->getChild('Client Details'))) { $primarySidebar->getChild('Client Details') ->setBodyHtml($address_new); } }); 0 Quote Link to comment Share on other sites More sharing options...
yarantoos Posted April 4, 2016 Share Posted April 4, 2016 Hello, Can I add a custom field ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 4, 2016 Share Posted April 4, 2016 Can I add a custom field ? i'm not sure asking the same question in two threads will get it answered any quicker... probably the opposite! http://forum.whmcs.com/showthread.php?112846-custom-field-in-quot-your-info-quot-box&p=458330#post458330 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.