Custom Module Help

#1

Hey guys, I’m not a php developer but, I’m trying to create a very simple custom module. I already use a plugin for online donations that you can use a shortcode to put on the page. What I’m trying to do is simply create a module that puts that shortcode on the page. I was following the documentation but am not sure how to proceed. Here’s a link to what I have: https://drive.google.com/folderview?id=0BzX_FTrlcLzEckFUWHVXdGxGTEU&usp=sharing and the shortcode I need to add is [tithely] any help would be great!

#2

Hey Kevin,

I took a look at the module and it looks like your PHP files are missing the opening PHP tags (maybe Google docs removed them).

Another issue might be that you have a dash in your constants MR-GIVING_DIR and MR-GIVING_URL. Try changing that to an underscore.

To get the shortcode working, all you should have to do is paste it into your frontend.php file.

Give those a shot and let me know how it goes.

Justin

#3

[Content Hidden]

#4

Hey Kevin,

Can you send me a copy of the plugin to test at justin [at] fastlinemedia [dot] com?

Justin

#5

Thanks, Kevin. It looks like you’re missing the module register code in mr-giving.php…

FLBuilder::register_module( 'MyModuleClass', array() );

#6

Thanks Justin! Working now!

#7

Awesome! You’re welcome, Kevin!

#8

I tried to go a little further and got stuck. There are a couple of options that can be set inside of the shortcode.

I added this to my mr-giving.php

FLBuilder::register_module( 'MRGiving', array(
    'mr-tithely-settings'      => array(
        'title'         => __( 'Settings', 'fl-builder' ),
        'sections'      => array(
            'mr-section1'  => array(
                'title'         => __( 'Button Options', 'fl-builder' ),
                'fields'        => array(
                    'mr-church-id'     => array(
                        'type'          => 'text',
                        'label'         => __( 'Church ID', 'fl-builder' ),
                    ),
                    'mr-button-text'     => array(
                        'type'          => 'text',
                        'label'         => __( 'Button Text', 'fl-builder' ),
                    )
                )
            )
        )
    )
) );
?>

and I added this to my frontend.php
[tithely button="<?php echo $settings->mr-button-text; ?>" id="<?php echo $settings->mr-church-id; ?>"]

However after putting in that information in the BB editor it doesn’t get inputed into the button.

#9

Hey Kevin,

It think the dashes may be causing the issue again. In general, with PHP, it’s best to use underscores. Go ahead and replace those and let me know how it goes.

Justin

#10

That did the trick. Thanks for all the info Justin!

#11

Great! Have fun :slight_smile:

#12

Sorry for bugging you to death. Definitely going to have to work on increasing my dev knowledge after this. I’m wanting to add one more thing to my module. How can I add just a block of text under the two options telling people about where to get the information that they need to put in the options?

#13

No worries, Kevin. There isn’t a way to add it below, but you can add one for the entire tab. That can be done by setting a description for the tab like this…

FLBuilder::register_module( 'MRGiving', array(
    'mr-tithely-settings'      => array(
        'title'         => __( 'Settings', 'fl-builder' ),
        'description'   	=> 'YOUR TEXT HERE...',
        'sections'      => array(
            'mr-section1'  => array(
                'title'         => __( 'Button Options', 'fl-builder' ),
                'fields'        => array(
                    'mr-church-id'     => array(
                        'type'          => 'text',
                        'label'         => __( 'Church ID', 'fl-builder' ),
                    ),
                    'mr-button-text'     => array(
                        'type'          => 'text',
                        'label'         => __( 'Button Text', 'fl-builder' ),
                    )
                )
            )
        )
    )
) );
?>
#14

Thanks again Justin! You guys are the best at providing support!

#15

You’re welcome, Kevin!

closed #16