Joomla 3 Flexicontent form custom plugin - php

After hours of googling and experimenting, I gave up :(
I need to add form to my articles in Joomla 3, that collects data from article's additional fields and emails them. Articles are managed by Flexicontent. Flexicontent overrides standard content manager so I tried to make a plugin inside 'content' plugins (later I tried 'flexicontent' as well). Basing on articles:
http://docs.joomla.org/Adding_custom_fields_to_the_article_component
http://betweenbrain.com/notes/72-fun-with-joomla-forms
https://github.com/joomla/joomla-cms/blob/master/plugins/user/profile/profile.php#L168
which all override some kind of form (user, content or contact).
I made my plugin folder, plugin php file, plugin manifest (xml file) and xmls with form fields. Then in my php file I wrote onContentPrepareForm(), as instructed. However, when I checked "$this" variable in my flexiconent template, there were no signs of any form. How should I place this form in my template?

Related

build form in joomla and dispaly the list of content

I want build a form in joomla 3.3.1 and display content of form in list with several pages such as link below:
http://alkafeel.net/persian/zyara/view.php?pageNum_Recordset1=3122&totalRows_Recordset1=158555
but I have problem because
I don't find good form builder for joomla 3.3.1
i don't know whats the html code for display list of content that user submit
How can put the search box for search between displayed content
and also I should say I install rsform pro extension v1.49.7 but don't work correctly infact no one of options work
We are using Chronoforms for our forms. A great component with lot's of plugins and features. You are also able to access the formdata before submit. You can add custom code (html/php/js) to your forms and it's extremly flexible.
Just give it a try ;)
BTW: rsform should also work, it's a great component too! Maybe there is something wrong with your include of the plugin files or with your template.
All components add some scripts to the header with the given Joomla-function. Maybe there is something wrong with your configuration.

Display custom field tabs in front end article edit page in Joomla 3.x

I have been looking for a solution to display custom field tabs in the Joomla
front article edit page.
http://www.aixeena.org/extensions/aixeena-easy-cck
Aixeena Easy CCK
I installed the plugin of aixeena, two custom field tabs: the Extra content and Extra content 2 are displayed in the backend admin article edit page, which is great. But we also need to let regular edit their article and enter values in custom fields under those two tabs. Any idea how to achieve this?
I tried a couple of other sites posting the solution of adding custom fields in article, such as Rating region described in the site:
https://docs.joomla.org/Adding_custom_fields_to_the_article_component
I was not able to make the Rating tab displayed in the front end article edit page neither.
I tried the fieldattach, it does supports custom field tab ( which is the group name of custom field), the list field type only contains static values, we have to define fieldset and field type through xml file.
Any help is greatly appreciated.
I just finished writing a couple pluginsto do this similar thing. I wrote my own plugin to add the extra fields - but it looks like the one you've already used is very similar.
I had a really hard time figuring out how to add the fields for frontend editing as well. But I finally figured it out.
First, you're going to need to copy the com_content form edit.php into a template override (/templates/your_template_name/html/com_content/form/edit.php).
In that file, add the extra fields you have. You'll need the name of the field that you put in the xml file for your plugin you already have. Add them right before/after the fields that are already in the file, that you want your fields to appear before/after. Example:
<!-- CUSTOM begin custom fields -->
<?php echo $this->form->renderField('video_url', 'attribs'); ?>
add all your fields in there - replacing 'video_url' with your own field name. The plugin you already have already saved these fields to the 'attribs' part of the article, so you can leave that there.
The plugin that I used to create the fields for the backend is a really simple one based off of this tutorial https://zunostudios.com/blog/development/203-how-to-add-custom-fields-to-articles-in-joomla
What I'd suggest is to go ahead and create that plugin too. Except in the zfields.php file, change "$app->isAdmin()" to "$app->isSite()" - make sure the xml files have the same names as your other plugin xml files, so they save to the same place, and you're done. The fields will show up on the frontend edit form now.
What I'd really recommend is to get rid of the Aixeena plugin, and just make that easy plugin using the tutorial above - it's super easy. When you make it, duplicate the "if ($app->isAdmin())" section, copy it right below it, and change "isAdmin" to "isSite" - and now you've got the entire thing, all your custom fields, both frontend and backend, all in one place. Now just do the edit.php template override, and you'll have them displayed in both the front and backend. I hope that helps - if you need I can upload more example code.

Numerous wp-include files needed for simple php page

I am learning php in a sandbox. I have written a plugin and it works...till now.
So I am now wanting to save the options into the database and these settings are specific to the user so I am using:
update_user_meta
Well of course it said it needed user.php so after reading / learning how to include a file I added it. Well now it is dependat on plugin.php which has a dependency on functions.php which... so I'm up to four now. I must be doing something worng?
include(__DIR__.'/../wp-includes/functions.php');
include(__DIR__.'/../wp-includes/meta.php');
include(__DIR__.'/../wp-includes/plugin.php');
include(__DIR__.'/../wp-includes/user.php');
What I have is a plugin in the admin with a form for some settings. When button clicked form is posted to a php page for processing....it is this page (in wp-admin) that has the never ending include file list.
Is this to be expected or am I doing something wrong that these base wordpress libraries aren't available to my plugin?
TIA
The code in question should be within a plugin.
The core structure is:
/wp-content
/plugins
/mypluginname
/mypluginname.php
Then at the very least, mypluginname.php should contain the core code of the plugin, and any other php/wordpress logic you wish to have.
The plugin its self can be declared with the following:
/*
Plugin Name: Custom plugin
Plugin URI: http://domain.tld
Version: 1.0
Description: A custom plugin
Author: You
*/
Further, you can work around this and leverage core WP functions from external .php files that are not within the application by using require_once('/wp-load.php'); within your files. Note I do not recommend this method, it is just a direct answer to your question, but not the correct one.

Adding fields dynamically to a form after rendering

I'm developing a template system for webpages. A template consists of the following properties.
A name (part of the "template" class)
Sections (linked to the template class)
Fields (linked to a section)
It's pretty basic and it works when I got the template all setup in the database itself.
Now I want to create a template in my CMS application. To accomplish this I have rendered a pretty basic formtype form which has the name property of the template.
After the user has entered a name for the template, the user should be able to create sections and fields on the fly(directly from the rendered page itself). To spare me some time I want to ask you if it's possible to attach the sections and fields to the formtype dynamically so Doctrine can pick it up and persist the objects automatically without too much trouble.
What you are looking for is probably a combination of Form Events and Collection of Forms

Adding custom field in default joomla 3.1.1 registration form

Recently I have stumbled upon a situation in Joomla 3.1.1 where I need to add a custom field attached with default registration form.
I surfed the existing resources which say that I should navigate to
joomla_root/components/com_users/models/forms/registration.xml and then change the file accordingly.
I have done that but nothing is showing up. I also need to change registration.php in model and controller too. So, I need your inputs on how to do that. I can't use profile plugin or commercial extensions.
One more thing that I've noticed is the fact that changing registration.xml file and such things work perfectly fine in Joomla 2.5 but isn't working in 3.x.
Joomla ships with a user plugin called "profile" which may contain the fields you want to add already.
In the administrator go to extensions/plugins, filter by type and choose "user", then find the "Profile" and open it. Check out the options on the right handside, enable the plugin and voila.
Warning: most templates override the registration form and they usually don't fire the correct plugin events. If this is the case, your users will only see the "standard" fields in the registration. And if you set any fields as required in the plugin, they will not be registered, but redirected to the complete registration page (the user component), where they will find the fields they already filled in except for the passwords, which can be quite annoying.
If the "profile" fields are not sufficient, copy the profile plugin and build your own.
Do NOT modify the profile plugin or com_users files like you have done, this is Joomla core and will be overwritten when you next upgrade.
Eventually it turns out that the problem was a component called K2.I tried this custom registration stuff in joomla 2.5 and then suddenly thought how about disabling K2 System Plugin..It worked.
Im posting the steps to do so:
1.Navigate to joomla_root/components/com_users/models/forms/registration.xml and add a field there.
2.Then open up joomla_root/components/com_users/models/registration.php and then in the function register() change ur custom fields.
3.Don't forget to add a field in ur database table #_users which you have added in registration.xml
Depending on whether you needed the custom field to be added to the database or not, you could use a form building component such as RSForm!Pro or ChronoForms. They both can tie into the user registration system in Joomla and give you a lot of flexibility in custom emails, adding info to database tables, etc. This would insulate you from any core updates that could wipe out your modifications. I believe Chronoforms is free as long as you don't mind a link back to the developers in the form.
If you can't do that, I would make sure that I had a backup of the files that I modified handy before updating the site. Joomla 3.1.x is a short term build so you have a higher risk of those files getting changed than if you were working on a Joomla 2.5.x site.

Categories