When users sign up, they choose certain digital documents as part of their subscription. They can choose from more than 400 electronic documents that have been assigned multiple times to different users. I use Edocman to manage the group and individual owners of the documents. Right now, users select the documents they want from a multi-select list in Easy Profile when they register and then I have to manually add the documents to their accounts in Edocman. Then I manually add a custom module to their Easy Profile page which lists their assigned documents.
What I’ve been trying to do to make the process much faster is set up a custom multi-select field in Easy Profile with alias “practice_fields” which lists all documents. I used the DB parameters to populate the list options directly from the Edocman database. I also tried using basic value/options format like:
1|Document1
2|Document2
Edocman has a content plugin similar to Easy Profile which generates a direct download link to documents and is referenced by document ID. For example, I can call “Document 30” by referencing {edocmanlink 30}. I have created a separate delimiter field with alias “edocman_links.” The “edocman_links” field would be triggered by the member selecting a document from “practice_fields” during registration and then would automatically generate the link/icon to the Edocman document on the member’s profile page using the Edocman content plugin. I’ve been trying to make this work using PHP with the JsnUser API and “if” statements (using the Sorcerer plugin from Regular Labs) to generate the different links to documents. Basically, I would like to have a single delimiter field with references to 400 list options and 400 corresponding documents that would be shown or hidden based on the member's selection. I know I could accomplish the same thing more easily by simply creating 400 delimiter fields and then setting conditions, but I’d much rather have it all in one field. Also, I thought maybe it might be better to use database queries or SQL Custom Where statements, but I haven’t gotten those to work either. Below is a random sample of the code I’ve been trying to use with the “edocman_links” field based on my searches in the forum and hopefully gives you an idea of what I’m trying to do. The Edocman link is generated by the code so I know that the content plugin at least works. But the link is not affected by inputting different values/fields. I can put any value or field in the code and the Edocman link always shows up and is never hidden or changes. I have very little PHP coding experience so I’m sure I’m missing something simple or stupid. If you think there is an easier way that would be great too!
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$user=JsnHelper::getUser;
$user->getValue('practice_fields');
if($user->getValue('practice_fields')=1) {
echo '{edocmanlink 30}'; }
require_once( JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$user=JsnHelper::getUser;
$value_of_select=$user->getValue('practice_fields');
$output_of_select=$user->getField('practice_fields');
if($output_of_select="Litigation") {
echo '{edocmanlink 30}';
}
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$user=JsnHelper::getUser;
$user->getField('practice_fields');
if ($user->getField('practice_fields')=Litigation)) {
echo "{edocmanlink 30}";
}
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$user=JsnHelper::getUser;
$user->getValue('practice_fields');
if($user->getValue('practice_fields') {
echo "{edocmanlink 1}";
}