Custom Module Help

About this forum
These forums have not been active for several years. They're available for search and reference, but a lot of this information is likely out of date.

For current information, try visiting our Knowledge Base.

Home / Support / Custom Module Development / Custom Module Help

This topic is: resolved
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #35609

    Kevin
    Participant

    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!

    #35645

    Justin Busa
    Keymaster

    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

    #35649

    Kevin
    Participant
    This reply has been marked as private.
    #35661

    Justin Busa
    Keymaster

    Hey Kevin,

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

    Justin

    #35663

    Justin Busa
    Keymaster

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

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

    #35669

    Kevin
    Participant

    Thanks Justin! Working now!

    #35672

    Justin Busa
    Keymaster

    Awesome! You’re welcome, Kevin!

    #35687

    Kevin
    Participant

    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.

    #35707

    Justin Busa
    Keymaster

    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

    #35729

    Kevin
    Participant

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

    #35733

    Justin Busa
    Keymaster

    Great! Have fun 🙂

    #35796

    Kevin
    Participant

    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?

    #35811

    Justin Busa
    Keymaster

    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' ),
                        )
                    )
                )
            )
        )
    ) );
    ?>
    #35834

    Kevin
    Participant

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

    #35837

    Justin Busa
    Keymaster

    You’re welcome, Kevin!

Viewing 15 posts - 1 through 15 (of 15 total)

The forum ‘Custom Module Development’ is closed to new topics and replies.