Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Access/manipluate functions and classes to/from 3rd party plugins. Best practice?
#1
I need to add functionality and or call functions, class methods,
to and from 3rd party plugins for my custom theme.

I know I could add `cross directory` includes to a functions.php file in my theme's home directory,
but was wondering if this is best practice.

I also obviously do not want to edit the plugin's source as it could potentially break other themes usage of the plugin and still doesn't address the need for `cross directory` includes.

Thanks in advance for any advice or direction.
Reply
#2
By the time your template is called all plugins are loaded so you can just use them.
Maybe give more specifics.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
If thisbis for a theme use your own local functions tonwrap third party calls and use function exists or is callable checks to segment the code
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#4
Thanks for swift response.
(2016-11-07, 05:08:00)shawn_a Wrote: Maybe give more specifics.

My custom theme uses the plugin Front End User Login ( modified ).
However, my theme's form elements are different than the ones embedded in the above mentioned plugin's source.

So I'm trying to figure out:
  • Whether I create a set of similar functions and or class calls in my theme's directory?
  • If I should add my theme's functions to the plugins source ( prefer not to ) ?
  • If it's "secure" to include the plugin's source file in my theme's function file ?
  • If there is a better way to approach this ?
htms

(2016-11-07, 05:09:10)shawn_a Wrote: If thisbis for a theme use your own local functions tonwrap third party calls and use function exists or is callable checks to segment the code
hrm, ok I will test this out too.. Still just curious if it best practice though...
Reply
#5
It depends on if you are performing frontend actions. If you want to modify the behavior of a plugin on backend then that is not possible vis a theme. The form fields comment confuses me and i am nit entirely sure ehat you mean
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#6
(2016-11-07, 07:08:16)shawn_a Wrote: The form fields comment confuses me and i am nit entirely sure ehat you mean

My apologies.
------------------------------------------------------
This is the form that is embedded in the plugin's source:
[Image: gXRVLKa.jpg]
------------------------------------------------------
This is the form that I include ( registerform.inc.php ) as a part of my theme:
[Image: IpqrrNt.jpg]
------------------------------------------------------
The plugin's forms use a standard submit action, class and id attributes.
My forms use scripted AJAX submission, theme based class and id attributes.

That said, I still need the functionality of the plugin ( plugin class methods ).
Reply
#7
ohh that form, yeah you can just use your own method or the default ones in the plugin, I think it has some custom registration capability i have used, but technically it is exactly the same if you just let the plugin handle the form processing so i do not see why you cannot just let it do it itself and use your own code to submit and show result. Unless it is using some nonce you need or something
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#8
Ok great to know Smile

For clarity,
would I save my themes function in it's theme folder, or in the gs plugin folder?

Also, at some point if I choose to distribute my theme publicly,
would you suggest that I rewrite the entire plugin for use with this theme
( I've already added many new features & bug fixes ) ?
If yes, should it be an actual separate plugin ? Or just a theme function and or class ?

(2016-11-07, 09:54:23)shawn_a Wrote: ..i do not see why you cannot just let it do it itself and use your own code to submit and show result. Unless it is using some nonce you need or something
(2016-11-07, 07:36:31)roy_b8te Wrote: My forms use scripted AJAX submission...

Thanks again so much for this very helpful info.
Reply
#9
I would avoid duplicating plugins, it gets confusing, and globals name conflicts are a problem.

only plugins go in plugins
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#10
(2016-11-08, 00:40:35)shawn_a Wrote: ..globals name conflicts are a problem.
Good point.
Ok running tests today.

Thanks again.
Reply




Users browsing this thread: 1 Guest(s)