Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3630998
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:20:28+00:00 2026-05-19T00:20:28+00:00

I created a module to do all my form altering called form_mods. It’s working

  • 0

I created a module to do all my form altering called “form_mods”. It’s working for most situations but not for the Taxonomy page.

I’m targeting the form id of “taxonomy_overview_vocabularies”. I’m trying to hide the link “edit vocabulary” for roles of “webmaster” and “dj”.

My code is unsetting the $form array correctly, but Drupal is still displaying the “edit vocabulary” link.

function form_mods_form_alter($form, $form_state, $form_id) {

    if($form_id == 'taxonomy_overview_vocabularies'){

        global $user;
        $hide=0;
        $hideArray = array('webmaster', 'dj'); 
        foreach($user->roles AS $key => $value){
            if(in_array($value, $hideArray)){
                $hide++;
            }
        }

        if($hide){
            foreach($form AS $vocab){
                //print_r($vocab);
                if(isset($vocab['edit']['#value'])){
                    unset($vocab['edit']['#value']);
                }
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T00:20:28+00:00Added an answer on May 19, 2026 at 12:20 am

    Very small PHP mistake,
    when you want to change array members in a for each statement you have to pass them by reference & foreach($form AS &$vocab) otherwise the $vocab would be just a copy of the array

    foreach($form AS &$vocab){
            //print_r($vocab);
            if(isset($vocab['edit']['#value'])){
                unset($vocab['edit']['#value']);
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a prism application, I've just created my 1st module, fired it all
I've got (working) application done with ttk. It uses self-created module for showing a
I've created a custom module with it's own settings page where the administrator can
I am working on login/signup module(FYI no rolls/membership just a simple login form),data flow
I created module for admin specific operations. I don't want to write the same
I created module in netBean platform, then I created window component there, and I
I created a module to add some Extension Methods to a Class. This Class
i have created a module with this among others this function in it: <?php
I just created a module location.rb inside /lib folder with following contents: module Location
I have a DotNetNuke Module created in DNN 4.9.2. It runs fine on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.