Jump to content

LMX

Clients
  • Posts

    15
  • Joined

  • Last visited

LMX's Achievements

  1. Is it possible to re-order lessons inside a module once they have been created?
  2. Oh no problem. Thanks again!
  3. Yeah it looks like this has been causing more issues that it has been solving in CIC. I appreciate you pointing it out though @Paul E.. @Nathan Explosion any other thoughts?
  4. Keith this is in the future scope for us as well. I would love to hear if you are able to land on a solution for this.
  5. Does anyone know an easy way to inspect instance of an IPS class (vars/methods etc)? Basically I want to be able to print_r/var_dump/get_object_vars($classInstance) in the cloud hosted env. Example I am creating an "Add to calendar" button on event pages that will allow users to add events to their personal calendars (google, apple, outlook, etc...). This requires that I dynamically add event data. Up until now I have been looking at templates and trying to find the corresponding elements that render a given piece of data - e.g. $event->content(). There has to be a better way that is less of a stab into the dark... anyone have any thoughts!?
  6. Hello to whomever may stumble upon this! I work for a small organization that doesn't have the capacity to support a self hosted solution but still needed to extend upon the base functionality of the website. This means I don't have access to the developer console - as a result I have been experimenting over the last month or so with development on the cloud hosted version. While not ideal I have been able to accomplish some features that have been useful for us. If you are in a similar situation I hope this can be useful for you as well and perhaps save you some time. If you read this and think there are better ways to achieve these means I would be very happy to learn them. Please do share any ideas you may have if you care to do so! Here is an example of a Community Map we built via PHP & HTML custom blocks. PHP Block for getting member data - template key = "php_template_key" Standard API request as outlined in the docs with the addition of setting the returned data in the global $_SESSION variable to make it accessible from the front end HTML block. (thanks to @bfarber for that idea!). $communityUrl = 'BASE_URL_HERE'; $apiKey = 'API_KEY_HERE'; $endpoint = '/core/members?perPage=700'; $curl = curl_init( $communityUrl . 'api' . $endpoint ); curl_setopt_array( $curl, array( CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => "{$apiKey}:", CURLOPT_USERAGENT => "MyUserAgent/1.0" )); $response = curl_exec( $curl ); $_SESSION['apiResponseVariable'] = json_encode($response,JSON_HEX_APOS|JSON_HEX_QUOT); Since I only need member name, a custom field and their location I could (and probably should) groom the data here on the BE before passing to the front end. HTML Block for rendering map This requires you to enable Google Maps Third-party Enhancement at 'YOUR-DOMAIN/admin/?app=core&module=applications&controller=enhancements'. Some useful docs for working with the Google Maps API: https://developers.google.com/maps/documentation/javascript/adding-a-google-map https://developers.google.com/maps/documentation/javascript/marker-clustering {block="php_template_key"} {{$response = $_SESSION['apiResponseVariable'];}} <html> <head> <title>Community Map</title> <script src="https://unpkg.com/@google/markerclustererplus@4.0.1/dist/markerclustererplus.min.js"></script> <script src="https://maps.googleapis.com/maps/api/js?key=API_KEY&callback=initMap&libraries=&v=weekly" defer ></script> <style type="text/css"> #map { height: 400px; width: 100%; } .welcome-text { padding-bottom: 20px; } .welcome-text span { font-size: 16px; } </style> <script> function initMap() { let mapStyleOptions = [ { featureType: "water", elementType: "geometry", stylers: [ { color: "#d0d3d4" } ] }, { featureType: "landscape", elementType: "geometry", stylers: [ { color: "#dee2e3" } ], }, { featureType: "road", elementType: "geometry", stylers: [ { visibility: "off" } ], }]; const myMap = new google.maps.Map(document.getElementById("map"), { zoom: 2.5, center: {lat:24.63940428579627, lng:-50.6783944937192}, styles: mapStyleOptions, }); /* This is the messy bit of conforming the $apiResponseVariable to usable json */ let data = '{json_decode($response, TRUE)}'; data = data.replace('{json_decode("', ''); data = data.replace('", TRUE)}', ''); data = JSON.parse(data); let locations = []; let markers = []; let infowindow = new google.maps.InfoWindow(); data.results.forEach(member => { let memberLoc = JSON.parse(member.customFields[1].fields[2].value); if(memberLoc.lat !== null && memberLoc.long !== null) { let organization = member.customFields[1].fields[3].value; let memberName = member.formattedName; let memberUrl = member.profileUrl; let displayName = memberName; if (memberName != organization && organization != '') { displayName = memberName + ' - ' + organization; } locations.push({ id: memberLoc.lat.toString() + memberLoc.long.toString(), name: displayName, profileUrl: member.profileUrl, lat: memberLoc.lat, lng: memberLoc.long }); }; }); const uniqueLocations = Array.from(new Set(locations.map(a => a.id))) .map(id => { return locations.find(a => a.id === id) }); for (i = 0; i < uniqueLocations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(uniqueLocations[i].lat, uniqueLocations[i].lng), icon: { url: "some-custom-image-url", }, }); markers.push(marker); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { let UrlElement = '<a href="' + uniqueLocations[i].profileUrl + '">' + uniqueLocations[i].name + '</a>'; infowindow.setContent(UrlElement); infowindow.open(myMap, marker); } })(marker, i)); } let clusterImagePath = 'some-custom-image-url' new MarkerClusterer(myMap, markers, { imagePath: clusterImagePath, height: '100px', width: '100px', }); } </script> </head> <body> <div class="welcome-text"><h2>Welcome to the community map!</h2><span>Use our Community Map below to find and interact with other members.</span></div> <!--The div element for the map --> <div id="map"></div> </body> </html> I've used this pattern of BE API request and FE PHTML/JS jumble to achieve a fair amount of custom tooling so far (in the absence of access to the developer console). Hope this is useful to someone out there. Happy to answer any questions or receive feedback. Peace love and chicken grease.
  7. @bfarber apologies for resurrecting an old thread - quick question. If in this example "my_other_block" is a php block which returns an array like below... how would I access the data from that array in the phtml block? $exampleArray = Array( 'foo' => 'bar', 'baz' => Array( 'nestedFoo' => 'nestedBar' ) );
  8. The default criteria when using the search bar in the nav is "Everywhere" - of which I would expect "Members" to be a subset. However I can only find members when I explicitly toggle the member search filter. Is there a way to make this work more intuitively by default? The settings for search & discovery in the Admin CP are extremely limited. Example screencap attached. member search.mov
  9. Thanks bfarber, this is very useful. Would you mind providing me an example of what it would look like to call resources into a custom block via "URL generator" methods?
  10. Due to financial constraints my organization cannot support a self hosted option but I am still looking to develop additional features for our instance. Any advice on good ways to go about this? Right now I am using custom blocks but this requires a terrible conflation of HTML/CSS/JS into one file which is less than ideal. Another issue is there doesn't appear to be any way to utilize BE & FE code for one feature as custom blocks make you utilize just PHP or HTML. Is there a way to utilize ENV variable to hide my API keys in the custom blocks I make? I know this is a broad question and the answer may just be that I am SOL but I wanted to check in with all of you first before banging my head any further. Thanks!
  11. Essentially what I want to do is utilize the Blogs application as our content management system (guides, resources, documentation etc...). Is it possible to rename "Blogs" to something else like "Resources"? I understand that Blogs are DB entities and that this could intentionally not be feasible but if there is a way to just change the display name of the app I would love to know how. Thanks!
  12. LMX

    Email logo

    Did you ever get an answer to this question? I am also seeking to understand how to make the email logo setting a responsive design.
  13. I want to add a chatbot widget that will connect members of the community directly to one of our team members. Tools like livechat require you to add a script tag in the body of your html. Is there a simple and safe way to do this via the admin cp or is there a better approach that I haven't considered (aside from paid marketplace plugins). Thanks!
×
×
  • Create New...