Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Wednesday, May 29, 2013

How to reset magento Admin user, role and resources permission to all?

scenario 1: All resource permissions were set to none for the admin role
Solution:
Step 1: Get current admin role details
SELECT * FROM admin_role WHERE role_name = 'Administrators' 
/*Administrators - is  Your admin role name*/
Step 2: Remove Existing permissions for the Admin role
/*clean all permission rules*/
DELETE admin_rule
 FROM admin_rule, admin_role
WHERE 
 admin_role.role_name = 'Administrators' /* Your admin role name*/
 AND admin_rule.role_id = admin_role.role_id
Step 3: Update Permission rule for the admin role
INSERT INTO admin_rule (role_id, resource_id, assert_id, role_type, permission)
VALUES ('1','all', '0', 'G', 'allow')
scenario 2: Admin was assignd to a wron role
Solution:
Step 1: Load your user information
    
  SELECT ar.*, au.*
  FROM admin_user AS au
  INNER JOIN admin_role AS ar ON (au.user_id = ar.user_id)
  WHERE au.username = 'username'
Step 2: Load Role information
SELECT * FROM admin_role WHERE role_type = 'G'
Step 3:Update your user for the proper role
UPDATE admin_role SET parent_id = [put selected role_id here] WHERE user_id = [your USER id]

Wednesday, September 7, 2011

How to add Terms and Conditions in magento customer registration form?

While customer registration sometimes we need to add Terms & Conditon page with checkbox. Here is the code to add terms & condition field to your registration form.
<?php echo $this->__('I have read and agreed to the ') ?><a href="#">Terms and Conditions</a> <input type="checkbox" name="terms" title="<?php echo $this->__('Terms and Conditions') ?>" value="1" id="terms" class="checkbox required-entry" />

How to add address field in magento customer registration form?

If you want to add address details in your form you are in luck. Those fields are already setup in the "template/customer/form/register.phtml" file, but they are disabled by an inactive if statement that so far has not actually been linked to anything else in Magento. Therefore to enable the address related fields you simply need to comment out or delete the following statements:

<?php if($this->getShowAddressFields()): ?>

and

<?php endif; ?>

Note that there are two occurrences of this if statement. One is around the area where the customer actually inputs their data  and the second statement is bottom of the file around some JavaScript code that sets up the State/Province select.