web development blog
27 Dec 2018
Solution when INT value is converted to 2147483647
When inserting a record, I was trying to insert the value 2403919011 to a field with type INT and length of 11. On insert it would insert the value 2147483647 instead.
The issue was with field type of INT, the maximum integer value in hold is 2147483647, since the number I was inserting was larger it would default to the maximum number allowed.
SOLUTION: In your MySQL table, change the field type to BIGINT.
ALTER TABLE `name` MODIFY COLUMN `field_name` bigint(20) NOT NULL DEFAULT 0
23 Dec 2018
Quick way to rename post or get variables in PHP
foreach ($_REQUEST as $key=>$value) { $$key = $value; }
14 Nov 2018
Remove Items From Admin Menu Based On User Group Id
I wanted to remove menu item at tha admin level based on the usergroup assigned.
The file that needs changing is menu.tpl in the design folder.
The first step is to check the usergroup of the user:
{assign var="display_menu" value="1"} {if 22|in_array:$auth.usergroup_ids} {assign var="display_menu" value="0"} {/if}Then having the $display_menu variable set, I can turn off menu items. In this example, I check if the home button should be displayed. In my case, if the group id is equal to 22, then it will not display it.
{if $display_menu == 1}
recent posts