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 3276914
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:18:43+00:00 2026-05-17T19:18:43+00:00

So I have created a custom module for Drupal 6.x and it works as

  • 0

So I have created a custom module for Drupal 6.x and it works as I can see the desired results in the page.tpl.php page, but when I edit a page from the GUI (it allows php tags) the object is not accessible.

I can set the values in a SESSION which I can access from the GUI as well as the module but is this the correct way to do this?

Here is the error I get:

Fatal error: Call to a member function getEmail() on a non-object in /var/www/domain/includes/common.inc(1695) : eval()'d code on line 221

Call Stack
#   Time    Memory  Function    Location
1   0.0003  64108   {main}( )   ../index.php:0
2   0.0965  11659504    menu_execute_active_handler( )  ../index.php:18
3   0.1040  12626908    call_user_func_array ( )    ../menu.inc:348
4   0.1040  12627316    node_page_view( )   ../menu.inc:0
5   0.1040  12627532    node_show( )    ../node.module:1797
6   0.1040  12627848    node_view( )    ../node.module:1101
7   0.1040  12628192    node_build_content( )   ../node.module:1006
8   0.1041  12648832    node_prepare( ) ../node.module:1085
9   0.1041  12649112    check_markup( ) ../node.module:1041
10  0.1047  12671980    module_invoke( )    ../filter.module:457
11  0.1047  12693240    call_user_func_array ( )    ../module.inc:462
12  0.1047  12693900    php_filter( )   ../module.inc:0
13  0.1048  12694164    drupal_eval( )  ../php.module:82
14  0.1059  12883728    eval( ''?>

getEmail() is a function in a class that is in my custom module. I can call it from the page.tpl.php just fine, so why can’t I call it from a page that I have edited in the Admin GUI?

EDIT:

Adding Code from Module:

//wrapperFunction() is calling the class and setting the values
// this is just a getter/setter class w/ 1 function that formats a phone number, nothing special
$custom = new CustomObj(); 
$custom->setEmail('blah@blah,com');

return $custom;

page.tpl.php

// calls the wrapper function and returns the object
$custom_obj = wrapperFunction();
echo $custom_obj->getEmail(); // this prints the email just fine

Edit page through the Admin GUI (Allows PHP tags)
Adding this code to the page

<?php echo $custom_obj->getEmail(); ?> // throws the error

Sorry this is my first Drupal Module so any insight would be great as I’m also new to using Drupal, sigh…

  • 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-17T19:18:43+00:00Added an answer on May 17, 2026 at 7:18 pm

    Well to solve my problem I moved all the logic to the module and the fields I wanted to change on the fly I set to session. so in the page.tpl.php page I checked if the SESSION value was set, if it was use it else use a default value. By using SESSION I was able to pass all the desired values to any page regardless of where the page was made (GUI or Hard coded).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few custom tables in my Drupal database that were created manually.
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I
I have created a custom dialog for Visual Studio Setup Project using the steps
If have created a custom role within SqlServer which I added to the db__denydatareader
I have created a simple Asp.Net custom control which automatically combines all the correct
I have created a small flash CS4 project that has a few custom components
I'm interested in seeing what custom extensions other developers have created for the ASP.NET
I've created a custom object, I have it appearing automatically on the Account details
I have an application that has created a number of custom event log sources
I am working on developing a drupal site right now. I have created a

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.