Hello there,
I am using jomsocial with ReadyBytes JSPT as platform of my site. I m using a registration form made by me with Breezing Forms extension where I create a jomsocial album during the user submission.
I would like to call, at the end of submission, the jomsocial modal upload page to let my users send their pictures to the album setted during registration.
At this point I already have a new user ID and the album ID, and the directory already exists in the server, so my problem is how could I call the jomsocial modal upload page through PHP code and let the user send photos? (PS:the user is not logged in yet as he just finished the registration)
I am ataching an image showing the page I am talking about,
Thanks in advance
Hi,
Its hard to upload new photos before user is not login yet, because you will be redirected since that modal page is forbidden for guest. This trick is not easy you need hack jomsocial core code.
but anyway to call the modal for upload photos you can use this code (I think you already know):
joms.api.photoUpload('ID', '', '');
Hello Dimas,
Thank you for your fast response!
I have few questions to take a decision if I will workaround, hack or something else.... I really would like to make users upload photos during registration!!
1) If I use Breezing Forms upload features to upload the user photos would I have any re-size image problems with jomsocial? I was wondering to use jomsocial upload feature to avoid settings problems, but I don´t know if they(problems) will really exist.
2) You think could I login the user by code after registration, open the jomsocial modal page and logoff by code when the user finish the upload and close the modal page?
3) If I hack the Jomsocial core code, which file should I go?
4) If the user is already logged, the statements bellow would be sufficient to open the modal window (of course changing ID for the user Album ID value!)
require_once JPATH_ROOT.'/components/com_community/libraries/core.php';
joms.api.photoUpload('ID', '', '');
well, I can say this is very tricky, I cant help you too much / I cant provide you the pointer because this is hard to achived..
you have plan to required photos for new user, right? I suggest you use the plugin for this, please check this
www.jomsocial.com/addons/applications/jo...ess-jspc-by-joomlaxi
, this plugin developed by joomlaxi, maybe you can contact them for further information
Hello Dimas,
I already know JSPC from readybytes. I bought JSPT and it comes together in a bundle, but this is not what I need, because my
site won´t be a community. My end user will mostly make registration by smartphone and it is important to do everything in one step!
I understood you can´t help me pointing where to hack jomsocial, and I already discarded this option.
I am thinking in a workaround where at the end of registration the user will be logged in by code (this is ready) and redirected
to this page:
Hi,
I see, i think this is proper solution
- use 3rd party to automatic login like this
www.jomsocial.com/addons/core-enhancemen...o-login-and-redirect
- and redirect at the end of registration process, open this file components/com_community/views/register/view.html.php change this function registerSucess()
I hope it will help :)
Hello Dimas,
I did the code to auto login the user just after registration through my custom form.
My question is:
How do I use this javascript funtion
joms.api.photoUpload('ID', '', '');
You need the trigger for this, and only can be done from html / template side..eg :
<a href="javascript:void(0)" onclick="joms.api.photoUpload('ID', '', '');">Upload photo</a>
$( document ).ready(function() {
joms.api.photoUpload('ID', '', '');
});
Hello Dimas,
Thank you for the code in the last post.
As I said before I am using Breezing Forms to do my custom login. The first option you gave to start the modal page through a button in my form worked well, but unfortunately I will need to use the second option starting it when the end user submit the form (Motive: the modal page has a button linking to other pages after the user upload images).
Breezing Forms extension has several points of insertion of code (before form, after form, etc) where I tried this code:
echo '<script>
$( document ).ready(function() {joms.api.photoUpload();});
</script>';
complemento-do-registro:890 Uncaught TypeError: $(...).ready is not a function
You need to load jquery library freamwork, do you know to do it right? :)
Hi Dimas,
It wasn´t Jquery library, following Breezing Form support sugestion. I changed the expression to this:
echo "<script >JQuery( document ).ready(function() {joms.api.photoUpload('116','','');});</script>";
Uncaught TypeError: Cannot read property 'photoUpload' of undefined
(anonymous function) @ complemento-do-registro:3538
j @ jquery.min.js:2
kfireWith @ jquery.min.js:2
m.extend.ready @ jquery.min.js:2
J @ jquery.min.js:2
echo "<script >JQuery( document ).ready(function() {console.log( 'Working!' );});</script>";
Hello Dimas
I put this code in a javascript insertion point of breezing form:
JQuery( document ).ready(function() {joms.api.photoUpload('116','','');});
Uncaught TypeError: Cannot read property 'prepare' of undefined bundle.js?_=1460647683105:7
(anonymous function) @ bundle.js?_=1460647683105:7
photoUpload @ bundle.js?_=1460647683105:9
(anonymous function) @ complemento-do-registro:927
j @ jquery.min.js:2
k.add @ jquery.min.js:2
m.fn.ready @ jquery.min.js:2
ff_complemento_submitted @ complemento-do-registro:927
onload @ complemento-do-registro:896
Please make sure you already loaded all Jomsocial javascript library :
<script src="/jomsocial/components/com_community/assets/release/js/loader.js" type="text/javascript"></script>
<script src="/jomsocial/components/com_community/assets/release_32/js/bundle.js" type="text/javascript"></script>
<script src="/jomsocial/components/com_community/assets/vendors/toolkit.min.js" type="text/javascript"></script>
<script src="/jomsocial/media/jui/js/jquery.min.js" type="text/javascript"></script>
<script src="/jomsocial/media/jui/js/jquery-noconflict.js" type="text/javascript"></script>
<script src="/jomsocial/media/jui/js/jquery-migrate.min.js" type="text/javascript"></script>
<script src="/jomsocial/media/jui/js/bootstrap.min.js" type="text/javascript"></script>
</script><script type="text/javascript" src="/jomsocial/plugins/system/jomsocial.system/pc_includes/ajax_1.5.pack.js"></script>
Hi Dimas,
Almost there!
Still missing one library as you can see in the bellow console error log:
bundle.js?_=1460733125214:1 Uncaught TypeError: Cannot read property 'match' of undefined